@@ -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