testing
Buffer¶
zarr.testing.buffer ¶
NDBufferUsingTestNDArrayLike ¶
Bases: NDBuffer
Example of a custom NDBuffer that handles MyNDArrayLike
Source code in zarr/testing/buffer.py
all_equal ¶
Compare to other
using np.array_equal.
Source code in zarr/core/buffer/core.py
as_ndarray_like ¶
as_ndarray_like() -> NDArrayLike
Returns the underlying array (host or device memory) of this buffer
This will never copy data.
Returns:
-
The underlying array such as a NumPy or CuPy array.
–
Source code in zarr/core/buffer/core.py
as_numpy_array ¶
Returns the buffer as a NumPy array (host memory).
Warnings
Might have to copy data, consider using .as_ndarray_like()
instead.
Returns:
-
NumPy array of this buffer (might be a data copy)
–
Source code in zarr/core/buffer/cpu.py
as_scalar ¶
Returns the buffer as a scalar value
create
classmethod
¶
create(
*,
shape: Iterable[int],
dtype: DTypeLike,
order: Literal["C", "F"] = "C",
fill_value: Any | None = None,
) -> Self
Overwrite NDBuffer.create
to create an TestNDArrayLike instance
Source code in zarr/testing/buffer.py
empty
classmethod
¶
Create an empty buffer with the given shape, dtype, and order.
This method can be faster than NDBuffer.create
because it doesn't
have to initialize the memory used by the underlying ndarray-like
object.
Parameters:
-
shape
(tuple[int, ...]
) –The shape of the buffer and its underlying ndarray-like object
-
dtype
(DTypeLike
) –The datatype of the buffer and its underlying ndarray-like object
-
order
(Literal['C', 'F']
, default:'C'
) –Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Returns:
-
buffer
–New buffer representing a new ndarray_like object with empty data.
See Also
NDBuffer.create Create a new buffer with some initial fill value.
from_ndarray_like
classmethod
¶
from_ndarray_like(ndarray_like: NDArrayLike) -> Self
Create a new buffer of a ndarray-like object
Parameters:
-
ndarray_like
(NDArrayLike
) –ndarray-like object
Returns:
-
New buffer representing `ndarray_like`
–
Source code in zarr/core/buffer/core.py
StoreExpectingTestBuffer ¶
Bases: MemoryStore
Example of a custom Store that expect MyBuffer for all its non-metadata
We assume that keys containing "json" is metadata
Source code in zarr/testing/buffer.py
supports_consolidated_metadata
property
¶
supports_consolidated_metadata: bool
Does the store support consolidated metadata?.
If it doesn't an error will be raised on requests to consolidate the metadata.
Returning False
can be useful for stores which implement their own
consolidation mechanism outside of the zarr-python implementation.
supports_deletes
class-attribute
instance-attribute
¶
supports_deletes: bool = True
Does the store support deletes?
supports_listing
class-attribute
instance-attribute
¶
supports_listing: bool = True
Does the store support listing?
supports_partial_writes
property
¶
supports_partial_writes: Literal[False]
Does the store support partial writes?
Partial writes are no longer used by Zarr, so this is always false.
supports_writes
class-attribute
instance-attribute
¶
supports_writes: bool = True
Does the store support writes?
__eq__ ¶
__exit__ ¶
__exit__(
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> None
clear
async
¶
close ¶
delete_dir
async
¶
delete_dir(prefix: str) -> None
Remove all keys and prefixes in the store that begin with a given prefix.
Source code in zarr/abc/store.py
exists
async
¶
get
async
¶
get(
key: str,
prototype: BufferPrototype,
byte_range: tuple[int, int | None] | None = None,
) -> Buffer | None
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
, default:None
) –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
–
Source code in zarr/testing/buffer.py
get_partial_values
async
¶
get_partial_values(
prototype: BufferPrototype,
key_ranges: Iterable[tuple[str, ByteRequest | None]],
) -> list[Buffer | None]
Retrieve possibly partial values from given key_ranges.
Parameters:
-
prototype
(BufferPrototype
) –The prototype of the output buffer. Stores may support a default buffer prototype.
-
key_ranges
(Iterable[tuple[str, tuple[int | None, int | None]]]
) –Ordered set of key, range pairs, a key may occur multiple times with different ranges
Returns:
-
list of values, in the order of the key_ranges, may contain null/none for missing keys
–
Source code in zarr/storage/_memory.py
getsize
async
¶
Return the size, in bytes, of a value in a Store.
Parameters:
-
key
(str
) –
Returns:
-
nbytes
(int
) –The size of the value (in bytes).
Raises:
-
FileNotFoundError
–When the given key does not exist in the store.
Source code in zarr/abc/store.py
getsize_prefix
async
¶
Return the size, in bytes, of all values under a prefix.
Parameters:
-
prefix
(str
) –The prefix of the directory to measure.
Returns:
-
nbytes
(int
) –The sum of the sizes of the values in the directory (in bytes).
See Also
zarr.Array.nbytes_stored Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to
listing all the keys under a prefix calling Store.getsize
on each.
In general, prefix
should be the path of an Array or Group in the Store.
Implementations may differ on the behavior when some other prefix
is provided.
Source code in zarr/abc/store.py
is_empty
async
¶
Check if the directory is empty.
Parameters:
-
prefix
(str
) –Prefix of keys to check.
Returns:
-
bool
–True if the store is empty, False otherwise.
Source code in zarr/abc/store.py
list
async
¶
list() -> AsyncIterator[str]
list_dir
async
¶
list_dir(prefix: str) -> AsyncIterator[str]
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
Parameters:
-
prefix
(str
) –
Returns:
-
AsyncIterator[str]
–
Source code in zarr/storage/_memory.py
list_prefix
async
¶
list_prefix(prefix: str) -> AsyncIterator[str]
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
Parameters:
-
prefix
(str
) –
Returns:
-
AsyncIterator[str]
–
Source code in zarr/storage/_memory.py
open
async
classmethod
¶
Create and open the store.
Parameters:
-
*args
(Any
, default:()
) –Positional arguments to pass to the store constructor.
-
**kwargs
(Any
, default:{}
) –Keyword arguments to pass to the store constructor.
Returns:
-
Store
–The opened store instance.
Source code in zarr/abc/store.py
set
async
¶
Store a (key, value) pair.
Parameters:
set_if_not_exists
async
¶
Store a key to value
if the key is not already present.
Parameters:
with_read_only ¶
with_read_only(read_only: bool = False) -> MemoryStore
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
Parameters:
-
read_only
(bool
, default:False
) –If True, the store will be created in read-only mode. Defaults to False.
Returns:
-
A new store of the same type with the new read only attribute.
–
TestBuffer ¶
Bases: Buffer
Example of a custom Buffer that handles ArrayLike
Source code in zarr/testing/buffer.py
__add__ ¶
Concatenate two buffers
Source code in zarr/core/buffer/cpu.py
as_array_like ¶
as_array_like() -> ArrayLike
Returns the underlying array (host or device memory) of this buffer
This will never copy data.
Returns:
-
The underlying 1d array such as a NumPy or CuPy array.
–
Source code in zarr/core/buffer/core.py
as_buffer_like ¶
Returns the buffer as an object that implements the Python buffer protocol.
Notes
Might have to copy data, since the implementation uses .as_numpy_array()
.
Returns:
-
An object that implements the Python buffer protocol
–
Source code in zarr/core/buffer/core.py
as_numpy_array ¶
Returns the buffer as a NumPy array (host memory).
Notes
Might have to copy data, consider using .as_array_like()
instead.
Returns:
-
NumPy array of this buffer (might be a data copy)
–
Source code in zarr/core/buffer/cpu.py
from_array_like
classmethod
¶
Create a new buffer of an array-like object
Parameters:
-
array_like
(ArrayLike
) –array-like object that must be 1-dim, contiguous, and byte dtype.
Returns:
-
New buffer representing `array_like`
–
Source code in zarr/core/buffer/core.py
from_buffer
classmethod
¶
Create a new buffer of an existing Buffer
This is useful if you want to ensure that an existing buffer is of the correct subclass of Buffer. E.g., MemoryStore uses this to return a buffer instance of the subclass specified by its BufferPrototype argument.
Typically, this only copies data if the data has to be moved between memory types, such as from host to device memory.
Parameters:
-
buffer
(Buffer
) –buffer object.
Returns:
-
A new buffer representing the content of the input buffer
–
Notes
Subclasses of Buffer
must override this method to implement
more optimal conversions that avoid copies where possible
Source code in zarr/core/buffer/cpu.py
from_bytes
classmethod
¶
from_bytes(bytes_like: BytesLike) -> Self
Create a new buffer of a bytes-like object (host memory)
Parameters:
-
bytes_like
(BytesLike
) –bytes-like object
Returns:
-
New buffer representing `bytes_like`
–
Source code in zarr/core/buffer/cpu.py
to_bytes ¶
to_bytes() -> bytes
Returns the buffer as bytes
(host memory).
Warnings
Will always copy data, only use this method for small buffers such as metadata
buffers. If possible, use .as_numpy_array()
or .as_array_like()
instead.
Returns:
-
`bytes` of this buffer (data copy)
–
Source code in zarr/core/buffer/core.py
Stateful¶
zarr.testing.stateful ¶
SyncStoreWrapper ¶
Bases: SyncMixin
Source code in zarr/testing/stateful.py
__init__ ¶
__init__(store: Store) -> None
Synchronous Store wrapper
This class holds synchronous methods that map to async methods of Store classes. The synchronous wrapper is needed because hypothesis' stateful testing infra does not support asyncio so we redefine sync versions of the Store API. github.com/HypothesisWorks/hypothesis/issues/3712#issuecomment-1668999041
Source code in zarr/testing/stateful.py
ZarrHierarchyStateMachine ¶
Bases: SyncMixin
, 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.
Source code in zarr/testing/stateful.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
|
ZarrStoreStateMachine ¶
Bases: 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
Source code in zarr/testing/stateful.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
|
with_frequency ¶
This needs to be deterministic for hypothesis replaying
Source code in zarr/testing/stateful.py
Store¶
zarr.testing.store ¶
LatencyStore ¶
Bases: WrapperStore[Store]
A wrapper class that takes any store class in its constructor and
adds latency to the set
and get
methods. This can be used for
performance testing.
Source code in zarr/testing/store.py
supports_consolidated_metadata
property
¶
supports_consolidated_metadata: bool
Does the store support consolidated metadata?.
If it doesn't an error will be raised on requests to consolidate the metadata.
Returning False
can be useful for stores which implement their own
consolidation mechanism outside of the zarr-python implementation.
supports_partial_writes
property
¶
supports_partial_writes: Literal[False]
Does the store support partial writes?
Partial writes are no longer used by Zarr, so this is always false.
__eq__ ¶
__exit__ ¶
__exit__(
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> None
clear
async
¶
close ¶
exists
async
¶
get
async
¶
get(
key: str,
prototype: BufferPrototype,
byte_range: ByteRequest | None = None,
) -> Buffer | None
Add latency to the get
method.
Calls asyncio.sleep(self.get_latency)
before invoking the wrapped get
method.
Parameters:
-
key
(str
) –The key to get
-
prototype
(BufferPrototype
) –The BufferPrototype to use.
-
byte_range
(ByteRequest
, default:None
) –An optional byte range.
Returns:
-
buffer
(Buffer or None
) –
Source code in zarr/testing/store.py
get_partial_values
async
¶
get_partial_values(
prototype: BufferPrototype,
key_ranges: Iterable[tuple[str, ByteRequest | None]],
) -> list[Buffer | None]
Retrieve possibly partial values from given key_ranges.
Parameters:
-
prototype
(BufferPrototype
) –The prototype of the output buffer. Stores may support a default buffer prototype.
-
key_ranges
(Iterable[tuple[str, tuple[int | None, int | None]]]
) –Ordered set of key, range pairs, a key may occur multiple times with different ranges
Returns:
-
list of values, in the order of the key_ranges, may contain null/none for missing keys
–
getsize
async
¶
Return the size, in bytes, of a value in a Store.
Parameters:
-
key
(str
) –
Returns:
-
nbytes
(int
) –The size of the value (in bytes).
Raises:
-
FileNotFoundError
–When the given key does not exist in the store.
Source code in zarr/abc/store.py
getsize_prefix
async
¶
Return the size, in bytes, of all values under a prefix.
Parameters:
-
prefix
(str
) –The prefix of the directory to measure.
Returns:
-
nbytes
(int
) –The sum of the sizes of the values in the directory (in bytes).
See Also
zarr.Array.nbytes_stored Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to
listing all the keys under a prefix calling Store.getsize
on each.
In general, prefix
should be the path of an Array or Group in the Store.
Implementations may differ on the behavior when some other prefix
is provided.
Source code in zarr/abc/store.py
is_empty
async
¶
list_dir ¶
list_dir(prefix: str) -> AsyncIterator[str]
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
Parameters:
-
prefix
(str
) –
Returns:
-
AsyncIterator[str]
–
list_prefix ¶
list_prefix(prefix: str) -> AsyncIterator[str]
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
Parameters:
-
prefix
(str
) –
Returns:
-
AsyncIterator[str]
–
open
async
classmethod
¶
set
async
¶
Add latency to the set
method.
Calls asyncio.sleep(self.set_latency)
before invoking the wrapped set
method.
Parameters:
Returns:
-
None
–
Source code in zarr/testing/store.py
set_if_not_exists
async
¶
with_read_only ¶
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
Parameters:
-
read_only
(bool
, default:False
) –If True, the store will be created in read-only mode. Defaults to False.
Returns:
-
A new store of the same type with the new read only attribute.
–
Source code in zarr/abc/store.py
StoreTests ¶
Bases: Generic[S, B]
Source code in zarr/testing/store.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
get
abstractmethod
async
¶
Retrieve a value from a storage backend, by key. This should not use any store methods. Bypassing the store methods allows them to be tested.
set
abstractmethod
async
¶
Insert a value into a storage backend, with a specific key. This should not use any store methods. Bypassing the store methods allows them to be tested.
Source code in zarr/testing/store.py
store_kwargs
abstractmethod
¶
test_get
async
¶
Ensure that data can be read from the store using the store.get method.
Source code in zarr/testing/store.py
test_get_many
async
¶
Ensure that multiple keys can be retrieved at once with the _get_many method.
Source code in zarr/testing/store.py
test_get_not_open
async
¶
Ensure that data can be read from the store that isn't yet open using the store.get method.
Source code in zarr/testing/store.py
test_get_raises
async
¶
Ensure that a ValueError is raise for invalid byte range syntax
Source code in zarr/testing/store.py
test_getsize
async
¶
Test the result of store.getsize().
Source code in zarr/testing/store.py
test_getsize_prefix
async
¶
Test the result of store.getsize_prefix().
Source code in zarr/testing/store.py
test_getsize_raises
async
¶
Test that getsize() raise a FileNotFoundError if the key doesn't exist.
test_list_empty_path
async
¶
Verify that list and list_prefix work correctly when path is an empty string, i.e. no unwanted replacement occurs.
Source code in zarr/testing/store.py
test_list_prefix
async
¶
Test that the list_prefix
method works as intended. Given a prefix, it should return
all the keys in storage that start with this prefix.
Source code in zarr/testing/store.py
test_set
async
¶
Ensure that data can be written to the store using the store.set method.
Source code in zarr/testing/store.py
test_set_many
async
¶
Test that a dict of key : value pairs can be inserted into the store via the
_set_many
method.
Source code in zarr/testing/store.py
test_set_not_open
async
¶
Ensure that data can be written to the store that's not yet open using the store.set method.
Source code in zarr/testing/store.py
Strategies¶
zarr.testing.strategies ¶
basic_indices ¶
basic_indices(
draw: DrawFn,
*,
shape: tuple[int, ...],
min_dims: int = 0,
max_dims: int | None = None,
allow_newaxis: bool = False,
allow_ellipsis: bool = True,
) -> Any
Basic indices without unsupported negative slices.
Source code in zarr/testing/strategies.py
end_slices ¶
A strategy that slices ranges that include the last chunk. This is intended to stress-test handling of a possibly smaller last chunk.
Source code in zarr/testing/strategies.py
key_ranges ¶
key_ranges(
keys: SearchStrategy[str] = node_names,
max_size: int = maxsize,
) -> SearchStrategy[list[tuple[str, RangeByteRequest]]]
Function to generate key_ranges strategy for get_partial_values() returns list strategy w/ form::
[(key, (range_start, range_end)),
(key, (range_start, range_end)),...]
Source code in zarr/testing/strategies.py
np_array_and_chunks ¶
np_array_and_chunks(
draw: DrawFn,
*,
arrays: SearchStrategy[NDArray[Any]] = numpy_arrays(),
) -> tuple[ndarray, tuple[int, ...]]
A hypothesis strategy to generate small sized random arrays.
Returns: a tuple of the array and a suitable random chunking for it.
Source code in zarr/testing/strategies.py
numpy_arrays ¶
numpy_arrays(
draw: DrawFn,
*,
shapes: SearchStrategy[tuple[int, ...]] = array_shapes,
dtype: dtype[Any] | None = None,
) -> NDArray[Any]
Generate numpy arrays that can be saved in the provided Zarr format.
Source code in zarr/testing/strategies.py
orthogonal_indices ¶
orthogonal_indices(
draw: DrawFn, *, shape: tuple[int, ...]
) -> tuple[
tuple[ndarray[Any, Any], ...],
tuple[ndarray[Any, Any], ...],
]
Strategy that returns (1) a tuple of integer arrays used for orthogonal indexing of Zarr arrays. (2) an tuple of integer arrays that can be used for equivalent indexing of numpy arrays
Source code in zarr/testing/strategies.py
safe_unicode_for_dtype ¶
Generate UTF-8-safe text constrained to max_len of dtype.
Source code in zarr/testing/strategies.py
Utils¶
zarr.testing.utils ¶
assert_bytes_equal ¶
Help function to assert if two bytes-like or Buffers are equal
Warnings
Always copies data, only use for testing and debugging