2020 VLenUTF8Codec ,
2121 ZstdCodec ,
2222)
23- from zarr .codecs .sharding import ShardingCodec
2423from zarr .core ._info import ArrayInfo
2524from zarr .core .array import (
2625 CompressorsLike ,
@@ -494,7 +493,7 @@ def test_info_v2(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
494493 _read_only = False ,
495494 _store_type = "MemoryStore" ,
496495 _count_bytes = 512 ,
497- _compressor = numcodecs .Zstd (),
496+ _compressors = ( numcodecs .Zstd (), ),
498497 )
499498 assert result == expected
500499
@@ -510,9 +509,8 @@ def test_info_v3(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
510509 _order = "C" ,
511510 _read_only = False ,
512511 _store_type = "MemoryStore" ,
513- _codecs = (BytesCodec (), ZstdCodec ())
514- if shards is None
515- else (ShardingCodec (chunk_shape = chunks , codecs = [BytesCodec (), ZstdCodec ()]),),
512+ _compressors = (ZstdCodec (),),
513+ _serializer = BytesCodec (),
516514 _count_bytes = 512 ,
517515 )
518516 assert result == expected
@@ -536,7 +534,7 @@ def test_info_complete(self, chunks: tuple[int, int], shards: tuple[int, int] |
536534 _order = "C" ,
537535 _read_only = False ,
538536 _store_type = "MemoryStore" ,
539- _codecs = ( BytesCodec (),) if shards is None else ( ShardingCodec ( chunk_shape = chunks ), ),
537+ _serializer = BytesCodec (),
540538 _count_bytes = 512 ,
541539 _count_chunks_initialized = 0 ,
542540 _count_bytes_stored = 373 if shards is None else 578 , # the metadata?
@@ -572,7 +570,7 @@ async def test_info_v2_async(
572570 _read_only = False ,
573571 _store_type = "MemoryStore" ,
574572 _count_bytes = 512 ,
575- _compressor = numcodecs .Zstd (),
573+ _compressors = ( numcodecs .Zstd (), ),
576574 )
577575 assert result == expected
578576
@@ -596,9 +594,8 @@ async def test_info_v3_async(
596594 _order = "C" ,
597595 _read_only = False ,
598596 _store_type = "MemoryStore" ,
599- _codecs = (BytesCodec (), ZstdCodec ())
600- if shards is None
601- else (ShardingCodec (chunk_shape = chunks , codecs = [BytesCodec (), ZstdCodec ()]),),
597+ _compressors = (ZstdCodec (),),
598+ _serializer = BytesCodec (),
602599 _count_bytes = 512 ,
603600 )
604601 assert result == expected
@@ -624,7 +621,7 @@ async def test_info_complete_async(
624621 _order = "C" ,
625622 _read_only = False ,
626623 _store_type = "MemoryStore" ,
627- _codecs = ( BytesCodec (),) if shards is None else ( ShardingCodec ( chunk_shape = chunks ), ),
624+ _serializer = BytesCodec (),
628625 _count_bytes = 512 ,
629626 _count_chunks_initialized = 0 ,
630627 _count_bytes_stored = 373 if shards is None else 578 , # the metadata?
@@ -1125,16 +1122,24 @@ async def test_create_array_no_filters_compressors(
11251122 ({"name" : "transpose" , "configuration" : {"order" : [0 ]}},),
11261123 ],
11271124)
1125+ @pytest .mark .parametrize (("chunks" , "shards" ), [((6 ,), None ), ((3 ,), (6 ,))])
11281126async def test_create_array_v3_chunk_encoding (
1129- store : MemoryStore , compressors : CompressorsLike , filters : FiltersLike , dtype : str
1127+ store : MemoryStore ,
1128+ compressors : CompressorsLike ,
1129+ filters : FiltersLike ,
1130+ dtype : str ,
1131+ chunks : tuple [int , ...],
1132+ shards : tuple [int , ...] | None ,
11301133) -> None :
11311134 """
11321135 Test various possibilities for the compressors and filters parameter to create_array
11331136 """
11341137 arr = await create_array (
11351138 store = store ,
11361139 dtype = dtype ,
1137- shape = (10 ,),
1140+ shape = (12 ,),
1141+ chunks = chunks ,
1142+ shards = shards ,
11381143 zarr_format = 3 ,
11391144 filters = filters ,
11401145 compressors = compressors ,
0 commit comments