Skip to content

Commit 148356d

Browse files
committed
Merge branch 'master' into fix-iterating-over-sharding-index
# Conflicts: # tests/v3/test_codecs/test_sharding.py
2 parents bb4da5e + d09974c commit 148356d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/v3/test_codecs/test_sharding.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,28 @@ def test_pickle() -> None:
331331
codec = ShardingCodec(chunk_shape=(8, 8))
332332
assert pickle.loads(pickle.dumps(codec)) == codec
333333

334+
@pytest.mark.parametrize("store", ("local", "memory"), indirect=["store"])
335+
@pytest.mark.parametrize("index_location", [ShardingCodecIndexLocation.start, ShardingCodecIndexLocation.end])
336+
async def test_sharding_with_empty_inner_chunk(store: Store, index_location):
337+
data = np.arange(0, 16 * 16, dtype="uint32").reshape((16, 16))
338+
fill_value = 1
339+
340+
path = f"sharding_with_empty_inner_chunk_{index_location}"
341+
spath = StorePath(store, path)
342+
a = await AsyncArray.create(
343+
spath,
344+
shape=(16, 16),
345+
chunk_shape=(8, 8),
346+
dtype="uint32",
347+
fill_value=fill_value,
348+
codecs=[ShardingCodec(chunk_shape=(4, 4), index_location=index_location, index_codecs=[BytesCodec()])],
349+
)
350+
data[:4, :4] = fill_value
351+
await a.setitem(..., data)
352+
print("read data")
353+
data_read = await a.getitem(...)
354+
assert np.array_equal(data_read, data)
355+
334356

335357
@pytest.mark.parametrize("store", ["local", "memory"], indirect=["store"])
336358
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)