testing.ObjectDiff

What changed inside one object between two recorded states.

Usage

Source

testing.ObjectDiff(
    unit="entries",
    added=0,
    removed=0,
    modified=0,
    entries=list(),
    truncated=False,
    note=""
)

Backends describe changes at whatever granularity their system exposes natively and cheaply (files, tables, arrays, fragments, versions); unit names it. Entries are capped at MAX_DIFF_ENTRIES; counts are not.

Parameter Attributes

unit: str = "entries"

What is being counted: files, tables, arrays, fragments, commits, …

added: int = 0

Exact count of added units.

removed: int = 0

Exact count of removed units.

modified: int = 0

Exact count of modified (or renamed) units.

entries: list[ChangeEntry] = list()

Per-unit entries, capped at MAX_DIFF_ENTRIES.

truncated: bool = False

Whether entries were dropped because of the cap.

note: str = ""
Context the counts alone do not convey (e.g. a missing listing).

Attributes

Name Description
is_empty True when nothing changed.
summary One line: "+A -R ~M <unit>" plus truncation and note.

is_empty

True when nothing changed.

is_empty: bool


summary

One line: "+A -R ~M <unit>" plus truncation and note.

summary: str

Methods

Name Description
add() Record one change: bump the matching counter and append an entry.

add()

Record one change: bump the matching counter and append an entry.

Usage

Source

add(path, change, detail="")