Skip to content

Commit

Permalink
improve test_sharding_with_chunks_per_shard
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Oct 22, 2024
1 parent 139b862 commit f063515
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test_codecs/test_sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,22 +396,24 @@ async def test_sharding_with_empty_inner_chunk(

@pytest.mark.parametrize("store", ["local", "memory"], indirect=["store"])
@pytest.mark.parametrize(
"index_location", [ShardingCodecIndexLocation.start, ShardingCodecIndexLocation.end]
"index_location", [ShardingCodecIndexLocation.start, ShardingCodecIndexLocation.end],
)
async def test_sharding2(store: Store, index_location: ShardingCodecIndexLocation) -> None:
shape = (10, 2)
@pytest.mark.parametrize("chunks_per_shard", [(5,2), (2,5), (5,5)])
async def test_sharding_with_chunks_per_shard(store: Store, index_location: ShardingCodecIndexLocation, chunks_per_shard: tuple) -> None:
chunk_shape = (2,1)
shape = [x*y for x,y in zip(chunks_per_shard, chunk_shape, strict=False)]
data = np.ones(np.prod(shape), dtype="int32").reshape(shape)
fill_value = 42

path = f"test_sharding_2{index_location}"
path = f"test_sharding_with_chunks_per_shard_{index_location}"
spath = StorePath(store, path)
a = Array.create(
spath,
shape=shape,
chunk_shape=shape,
dtype="int32",
fill_value=fill_value,
codecs=[ShardingCodec(chunk_shape=(2, 1), index_location=index_location)],
codecs=[ShardingCodec(chunk_shape=chunk_shape, index_location=index_location)],
)
a[...] = data
data_read = a[...]
Expand Down

0 comments on commit f063515

Please sign in to comment.