zarr.testing.stateful#
Attributes#
Classes#
This state machine models operations that modify a zarr store's |
|
Functions#
|
|
|
This needs to be deterministic for hypothesis replaying |
Module Contents#
- class zarr.testing.stateful.SyncStoreWrapper(store: zarr.abc.store.Store)[source]#
Bases:
zarr.core.sync.SyncMixin- get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- get_partial_values(
- key_ranges: list[Any],
- prototype: zarr.core.buffer.BufferPrototype,
- property read_only: bool#
- store#
- property supports_deletes: bool#
- property supports_listing: bool#
- property supports_writes: bool#
- class zarr.testing.stateful.ZarrHierarchyStateMachine(store: zarr.abc.store.Store)[source]#
Bases:
zarr.core.sync.SyncMixin,hypothesis.stateful.RuleBasedStateMachineThis state machine models operations that modify a zarr store’s hierarchy. That is, user actions that modify arrays/groups as well as list operations. It is intended to be used by external stores, and compares their results to a MemoryStore that is assumed to be perfect.
- add_array(
- data: hypothesis.strategies.DataObject,
- name: str,
- array_and_chunks: tuple[numpy.ndarray[Any, Any], tuple[int, Ellipsis]],
- bundle(name)#
- check_invariants(settings, output, runtimes)#
- classmethod setup_state()#
- teardown()#
Called after a run has finished executing to clean up any necessary state.
Does nothing by default.
- TestCase#
- all_arrays: set[str]#
- all_groups: set[str]#
- bundles: dict[str, list]#
- invariants#
- model#
- names_counters: collections.Counter#
- names_list: list[str] = []#
- names_to_values: dict[str, Any]#
- rules#
- store#
- class zarr.testing.stateful.ZarrStoreStateMachine(store: zarr.abc.store.Store)[source]#
Bases:
hypothesis.stateful.RuleBasedStateMachine” Zarr store state machine
This is a subclass of a Hypothesis RuleBasedStateMachine. It is testing a framework to ensure that the state of a Zarr store matches an expected state after a set of random operations. It contains a store (currently, a Zarr MemoryStore) and a model, a simplified version of a zarr store (in this case, a dict). It also contains rules which represent actions that can be applied to a zarr store. Rules apply an action to both the store and the model, and invariants assert that the state of the model is equal to the state of the store. Hypothesis then generates sequences of rules, running invariants after each rule. It raises an error if a sequence produces discontinuity between state of the model and state of the store (ie. an invariant is violated). https://hypothesis.readthedocs.io/en/latest/stateful.html
- bundle(name)#
- check_invariants(settings, output, runtimes)#
- classmethod setup_state()#
- teardown()#
Called after a run has finished executing to clean up any necessary state.
Does nothing by default.
- TestCase#
- bundles: dict[str, list]#
- invariants#
- model: dict[str, zarr.core.buffer.Buffer]#
- names_counters: collections.Counter#
- names_list: list[str] = []#
- names_to_values: dict[str, Any]#
- prototype#
- rules#
- store#
- zarr.testing.stateful.with_frequency(frequency: float) collections.abc.Callable[[F], F][source]#
This needs to be deterministic for hypothesis replaying
- zarr.testing.stateful.F#
- zarr.testing.stateful.MAX_BINARY_SIZE = 100#