Skip to content

Commit 8db5fa7

Browse files
committed
expand nchunks_initialized test conditions
1 parent 80f6ac4 commit 8db5fa7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/test_array.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,19 +376,24 @@ def test_nchunks(test_cls: type[Array] | type[AsyncArray[Any]], nchunks: int) ->
376376

377377
@pytest.mark.parametrize("test_cls", [Array, AsyncArray[Any]])
378378
@pytest.mark.parametrize(
379-
("shape", "shard_shape", "chunk_shape"), [((10,), (1,), (1,)), ((40,), (20,), (5,))]
379+
("shape", "shard_shape", "chunk_shape"),
380+
[((10,), None, (1,)), ((10,), (1,), (1,)), ((40,), (20,), (5,))],
380381
)
381382
async def test_nchunks_initialized(
382383
test_cls: type[Array] | type[AsyncArray[Any]],
383384
shape: tuple[int, ...],
384-
shard_shape: tuple[int, ...],
385+
shard_shape: tuple[int, ...] | None,
385386
chunk_shape: tuple[int, ...],
386387
) -> None:
387388
"""
388389
Test that nchunks_initialized accurately returns the number of stored partitions.
389390
"""
390-
chunks_per_shard = np.prod(np.array(shard_shape) // np.array(chunk_shape))
391-
store = MemoryStore()
391+
store = {}
392+
if shard_shape is None:
393+
chunks_per_shard = 1
394+
else:
395+
chunks_per_shard = np.prod(np.array(shard_shape) // np.array(chunk_shape))
396+
392397
arr = zarr.create_array(store, shape=shape, shards=shard_shape, chunks=chunk_shape, dtype="i1")
393398

394399
# write chunks one at a time

0 commit comments

Comments
 (0)