zarr.testing.buffer
===================

.. py:module:: zarr.testing.buffer


Classes
-------

.. autoapisummary::

   zarr.testing.buffer.NDBufferUsingTestNDArrayLike
   zarr.testing.buffer.StoreExpectingTestBuffer
   zarr.testing.buffer.TestBuffer


Module Contents
---------------

.. py:class:: NDBufferUsingTestNDArrayLike(array: zarr.core.buffer.core.NDArrayLike)

   Bases: :py:obj:`zarr.core.buffer.cpu.NDBuffer`


   
   Example of a custom NDBuffer that handles MyNDArrayLike
















   ..
       !! processed by numpydoc !!

   .. py:method:: create(*, shape: collections.abc.Iterable[int], dtype: numpy.typing.DTypeLike, order: Literal['C', 'F'] = 'C', fill_value: Any | None = None) -> Self
      :classmethod:


      
      Overwrite `NDBuffer.create` to create an TestNDArrayLike instance
















      ..
          !! processed by numpydoc !!


.. py:class:: StoreExpectingTestBuffer(store_dict: collections.abc.MutableMapping[str, zarr.core.buffer.Buffer] | None = None, *, read_only: bool = False)

   Bases: :py:obj:`zarr.storage.MemoryStore`


   
   Example of a custom Store that expect MyBuffer for all its non-metadata

   We assume that keys containing "json" is metadata















   ..
       !! processed by numpydoc !!

   .. py:method:: get(key: str, prototype: zarr.core.buffer.BufferPrototype, byte_range: tuple[int, int | None] | None = None) -> zarr.core.buffer.Buffer | None
      :async:


      
      Retrieve the value associated with a given key.


      :Parameters:

          **key** : str
              ..

          **prototype** : BufferPrototype
              The prototype of the output buffer. Stores may support a default buffer prototype.

          **byte_range** : ByteRequest, optional
              ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved.
              - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned.
              - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header.
              - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.



      :Returns:

          Buffer
              ..











      ..
          !! processed by numpydoc !!


   .. py:method:: set(key: str, value: zarr.core.buffer.Buffer, byte_range: tuple[int, int] | None = None) -> None
      :async:


      
      Store a (key, value) pair.


      :Parameters:

          **key** : str
              ..

          **value** : Buffer
              ..














      ..
          !! processed by numpydoc !!


.. py:class:: TestBuffer(array_like: zarr.core.buffer.core.ArrayLike)

   Bases: :py:obj:`zarr.core.buffer.cpu.Buffer`


   
   Example of a custom Buffer that handles ArrayLike
















   ..
       !! processed by numpydoc !!

