antithesis._assertinfo

Basic Assertion Information

This module contains classes used to contain the details for basic assertions.

class AssertType(builtins.str, enum.Enum):

Used to differentiate type of basic assertions

ALWAYS = <AssertType.ALWAYS: 'always'>
SOMETIMES = <AssertType.SOMETIMES: 'sometimes'>
REACHABILITY = <AssertType.REACHABILITY: 'reachability'>
class AssertionKind(builtins.str, enum.Enum):

Which assertion function a declaration came from.

This is the typed form of the display_type field of serialized assertion events; the enum value is that string, which is also how the triage report labels the property. It is distinct from AssertType, the three-way wire-level type, which cannot tell always from always_or_unreachable, or reachable from unreachable, without also consulting must_hit.

ALWAYS = <AssertionKind.ALWAYS: 'Always'>
ALWAYS_OR_UNREACHABLE = <AssertionKind.ALWAYS_OR_UNREACHABLE: 'AlwaysOrUnreachable'>
SOMETIMES = <AssertionKind.SOMETIMES: 'Sometimes'>
REACHABLE = <AssertionKind.REACHABLE: 'Reachable'>
UNREACHABLE = <AssertionKind.UNREACHABLE: 'Unreachable'>
display_type: str

str: The display_type string serialized events carry for this kind.

assert_type: AssertType

AssertType: The wire-level assertion type for this kind.

must_hit: bool

bool: Whether the property fails when the assertion is never reached.

class AssertInfo:

Used to contain assertion details.

Attributes:
  • _hit (bool): True for runtime assertions, False if from an Assertion Catalog
  • _must_hit (bool): True if assertion must be hit at runtime
  • _assert_type (str): Logical handling type for a basic assertion
  • _display_type (str): Human readable name for a basic assertion
  • _message (str): Unique message associated with a basic assertion
  • _condition (bool): Runtime condition for the basic assertion
  • _id (str): Unique id for the basic assertion
  • _loc_info (Dict[str, Union[str, int]]): Caller information for the basic assertion (runtime and catalog)
  • _details (Mapping[str, Any]): Named details associated with a basic assertion at runtime
AssertInfo( hit: bool, must_hit: bool, assert_type: str, display_type: str, message: str, condition: bool, assert_id: str, loc_info: Dict[str, Union[str, int]], details: Mapping[str, Any])
hit: bool

bool: True for runtime assertions, False if from an Assertion Catalog

must_hit: bool

bool: True if assertion must be hit at runtime

assert_type: str

str: Logical handling type for a basic assertion

display_type: str

str: Human readable name for a basic assertion

message: str

str: Unique message associated with a basic assertion

condition: bool

bool: Runtime condition for the basic assertion

assert_id: str

str: Unique id for the basic assertion

loc_info: Dict[str, Union[str, int]]

Dict[str, Union[str, int]]: Basic Assertion caller information (runtime and catalog)

details: Mapping[str, Any]

Mapping[str, Any]: Named details associated with a basic assertion at runtime

def to_dict(self) -> Dict[str, Any]:

A dictionary representation of an AssertInfo object

Returns:

Dict[str, Any]: The dictionary representation of an AssertInfo object.