zarr.testing.stateful ===================== .. py:module:: zarr.testing.stateful Attributes ---------- .. autoapisummary:: zarr.testing.stateful.F zarr.testing.stateful.MAX_BINARY_SIZE Classes ------- .. autoapisummary:: zarr.testing.stateful.SyncStoreWrapper zarr.testing.stateful.ZarrHierarchyStateMachine zarr.testing.stateful.ZarrStoreStateMachine Functions --------- .. autoapisummary:: zarr.testing.stateful.split_prefix_name zarr.testing.stateful.with_frequency Module Contents --------------- .. py:class:: SyncStoreWrapper(store: zarr.abc.store.Store) Bases: :py:obj:`zarr.core.sync.SyncMixin` .. py:method:: clear() -> None .. py:method:: delete(path: str) -> None .. py:method:: exists(key: str) -> bool .. py:method:: get(key: str, prototype: zarr.core.buffer.BufferPrototype) -> zarr.core.buffer.Buffer | None .. py:method:: get_partial_values(key_ranges: list[Any], prototype: zarr.core.buffer.BufferPrototype) -> list[zarr.core.buffer.Buffer | None] .. py:method:: is_empty(prefix: str) -> bool .. py:method:: list() -> list[str] .. py:method:: list_dir(prefix: str) -> None :abstractmethod: .. py:method:: list_prefix(prefix: str) -> None :abstractmethod: .. py:method:: set(key: str, data_buffer: zarr.core.buffer.Buffer) -> None .. py:method:: set_partial_values(key_start_values: Any) -> None :abstractmethod: .. py:property:: read_only :type: bool .. py:attribute:: store .. py:property:: supports_deletes :type: bool .. py:property:: supports_listing :type: bool .. py:property:: supports_partial_writes :type: bool .. py:property:: supports_writes :type: bool .. py:class:: ZarrHierarchyStateMachine(store: zarr.abc.store.Store) Bases: :py:obj:`zarr.core.sync.SyncMixin`, :py:obj:`hypothesis.stateful.RuleBasedStateMachine` This 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. .. !! processed by numpydoc !! .. py:method:: add_array(data: hypothesis.strategies.DataObject, name: str, array_and_chunks: tuple[numpy.ndarray[Any, Any], tuple[int, Ellipsis]]) -> None .. py:method:: add_group(name: str, data: hypothesis.strategies.DataObject) -> None .. py:method:: can_add(path: str) -> bool .. py:method:: check_array(data: hypothesis.strategies.DataObject) -> None .. py:method:: check_list_dir(data: hypothesis.strategies.DataObject) -> None .. py:method:: check_list_prefix_from_root() -> None .. py:method:: clear() -> None .. py:method:: delete_array_using_del(data: hypothesis.strategies.DataObject) -> None .. py:method:: delete_chunk(data: hypothesis.strategies.DataObject) -> None .. py:method:: delete_dir(data: hypothesis.strategies.DataObject) -> None .. py:method:: delete_group_using_del(data: hypothesis.strategies.DataObject) -> None .. py:method:: draw_directory(data: hypothesis.strategies.DataObject) -> str .. py:method:: init_store() -> None .. py:method:: overwrite_array_basic_indexing(data: hypothesis.strategies.DataObject) -> None .. py:method:: overwrite_array_orthogonal_indexing(data: hypothesis.strategies.DataObject) -> None .. py:method:: resize_array(data: hypothesis.strategies.DataObject) -> None .. py:attribute:: all_arrays :type: set[str] .. py:attribute:: all_groups :type: set[str] .. py:attribute:: model .. py:attribute:: store .. py:class:: ZarrStoreStateMachine(store: zarr.abc.store.Store) Bases: :py:obj:`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 .. !! processed by numpydoc !! .. py:method:: check_num_zarr_keys_equal() -> None .. py:method:: check_paths_equal() -> None .. py:method:: check_vals_equal() -> None .. py:method:: check_zarr_keys() -> None .. py:method:: clear() -> None .. py:method:: delete(data: hypothesis.strategies.DataObject) -> None .. py:method:: exists(key: str) -> None .. py:method:: get(key: str, data: hypothesis.strategies.DataObject) -> None .. py:method:: get_invalid_zarr_keys(key: str, data: hypothesis.strategies.DataObject) -> None .. py:method:: get_partial_values(data: hypothesis.strategies.DataObject) -> None .. py:method:: init_store() -> None .. py:method:: is_empty() -> None .. py:method:: set(key: str, data: bytes) -> None .. py:attribute:: model :type: dict[str, zarr.core.buffer.Buffer] .. py:attribute:: prototype .. py:attribute:: store .. py:function:: split_prefix_name(path: str) -> tuple[str, str] .. py:function:: with_frequency(frequency: float) -> collections.abc.Callable[[F], F] This needs to be deterministic for hypothesis replaying .. !! processed by numpydoc !! .. py:data:: F .. py:data:: MAX_BINARY_SIZE :value: 100