@@ -396,22 +396,24 @@ async def test_sharding_with_empty_inner_chunk(
396396
397397@pytest .mark .parametrize ("store" , ["local" , "memory" ], indirect = ["store" ])
398398@pytest .mark .parametrize (
399- "index_location" , [ShardingCodecIndexLocation .start , ShardingCodecIndexLocation .end ]
399+ "index_location" , [ShardingCodecIndexLocation .start , ShardingCodecIndexLocation .end ],
400400)
401- async def test_sharding2 (store : Store , index_location : ShardingCodecIndexLocation ) -> None :
402- shape = (10 , 2 )
401+ @pytest .mark .parametrize ("chunks_per_shard" , [(5 ,2 ), (2 ,5 ), (5 ,5 )])
402+ async def test_sharding_with_chunks_per_shard (store : Store , index_location : ShardingCodecIndexLocation , chunks_per_shard : tuple ) -> None :
403+ chunk_shape = (2 ,1 )
404+ shape = [x * y for x ,y in zip (chunks_per_shard , chunk_shape , strict = False )]
403405 data = np .ones (np .prod (shape ), dtype = "int32" ).reshape (shape )
404406 fill_value = 42
405407
406- path = f"test_sharding_2 { index_location } "
408+ path = f"test_sharding_with_chunks_per_shard_ { index_location } "
407409 spath = StorePath (store , path )
408410 a = Array .create (
409411 spath ,
410412 shape = shape ,
411413 chunk_shape = shape ,
412414 dtype = "int32" ,
413415 fill_value = fill_value ,
414- codecs = [ShardingCodec (chunk_shape = ( 2 , 1 ) , index_location = index_location )],
416+ codecs = [ShardingCodec (chunk_shape = chunk_shape , index_location = index_location )],
415417 )
416418 a [...] = data
417419 data_read = a [...]
0 commit comments