Skip to content

expect_string

Snapshot testing and expectations for strings.

StringExpect

StringExpect(
    settings: Settings, snappylapy_session: SnapshotSession
)

Bases: BaseSnapshot[str]

Snapshot testing for strings.

Initialize the base snapshot.

compare_snapshot_data

compare_snapshot_data(
    snapshot_data: bytes, test_data: bytes
) -> None

Compare snapshot data with test data.

Optimizations is needed for large data since difflib used in the pytest_assertion plugin rewrites are very slow when there are many diffs in large strings.

to_align_with_snapshot

to_align_with_snapshot() -> None

Non-deterministic snapshot alignment.

Data structure specific implementations, can fuzzy match strings or compare data structures. The default behavior defined is always accepting the snapshot, but fails if the snapshot has not been created yet.

to_match_snapshot

to_match_snapshot() -> None

Assert test results match the snapshot.