intercom_test.augmentation.compact_file module

class intercom_test.augmentation.compact_file.CaseIndexer[source]

Bases: object

Collector of case keys and their “jump indexes” in a compact file

Objects of this class consume YAML events (as from yaml.parse()) and collect the test case keys and their corresponding starting offsets within the file, assuming the file represents the top level mapping in block format.

class State[source]

Bases: enum.Enum

An enumeration.

case_data = 3
case_key = 2
header = 1
tail = 4
read(event, origin_mapper: intercom_test.augmentation.origin_mapping_stream.OriginMapper)[source]
class intercom_test.augmentation.compact_file.DataValueReader(stream, start_byte, case_key, *, safe_loading=None)[source]

Bases: object

Reads the augmentation data for a single case in a compact file

The code constructing this object should know the starting byte offset into the stream and the test case key located at that offset. This allows the reader to skip directly to that case and process only that case.

augment(d)[source]
augmentation_data_events()[source]
safe_loading = True
class intercom_test.augmentation.compact_file.TestCaseAugmenter(file_path, offset, case_key, *, safe_loading=None)[source]

Bases: object

Callable to augment a test case from a compact entry

case_data_events()[source]
safe_loading = True
class intercom_test.augmentation.compact_file.Updater(updates, excluded_keys=())[source]

Bases: object

YAML event-stream editor for compact augumentation data files

Objects of this class support applying a set of updates/additions to the stream of YAML events from a compact augmentation data file. Each event is fed to filter(), which returns an iterable of events to include in the output.

Updates are a dict (or similar by duck-type) keyed by case keys; the corresponding or return values are either a dict of augmentation values to associate with the test case or an iterable of yaml.Event objects representing a YAML node to be used as the augmenting value. The event list approach allows more fidelity in preserving the representation from the update file.

class State[source]

Bases: enum.Enum

An enumeration.

case_data = 3
header = 1
tail = 4
top_mapping = 2
filter(event)[source]

Converts an event into an iterable of events (possibly empty)

intercom_test.augmentation.compact_file.augment_dict_from(d, file_ref, case_key, *, safe_loading=True)[source]
intercom_test.augmentation.compact_file.case_keys(data_file)[source]