@@ -430,6 +430,7 @@ def test_zarr_avg_merge_none_merged_shape_error(self):
430
430
431
431
def test_deprecated_compressor_warning (self ):
432
432
is_zarr_v3 = version_geq (get_package_version ("zarr" ), "3.0.0" )
433
+ codec_reg = numcodecs .registry .codec_registry
433
434
434
435
with warnings .catch_warnings (record = True ) as w :
435
436
warnings .simplefilter ("always" )
@@ -438,17 +439,16 @@ def test_deprecated_compressor_warning(self):
438
439
if is_zarr_v3 :
439
440
ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , codecs = ZARR_V3_LZ4_CODECS )
440
441
else :
441
- # For zarr v2, use string compressor
442
- ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , compressor = "LZ4" )
442
+ # For zarr v2, use Codec object
443
+ compressor = codec_reg ["lz4" ]()
444
+ ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , compressor = compressor )
443
445
444
446
# Only check for warnings under zarr v2
445
447
self .assertTrue (any ("compressor" in str (warning .message ) for warning in w ))
446
- self .assertTrue (any ("1.5.0" in str (warning .message ) for warning in w ))
447
- self .assertTrue (any ("1.7.0" in str (warning .message ) for warning in w ))
448
- self .assertTrue (any ("codecs" in str (warning .message ) for warning in w ))
449
448
450
449
def test_deprecated_value_compressor_warning (self ):
451
450
is_zarr_v3 = version_geq (get_package_version ("zarr" ), "3.0.0" )
451
+ codec_reg = numcodecs .registry .codec_registry
452
452
453
453
with warnings .catch_warnings (record = True ) as w :
454
454
warnings .simplefilter ("always" )
@@ -457,17 +457,16 @@ def test_deprecated_value_compressor_warning(self):
457
457
if is_zarr_v3 :
458
458
ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , value_codecs = ZARR_V3_LZ4_CODECS )
459
459
else :
460
- # For zarr v2, use string compressor
461
- ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , value_compressor = "LZ4" )
460
+ # For zarr v2, use Codec object
461
+ value_compressor = codec_reg ["lz4" ]()
462
+ ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , value_compressor = value_compressor )
462
463
463
464
# Only check for warnings under zarr v2
464
465
self .assertTrue (any ("value_compressor" in str (warning .message ) for warning in w ))
465
- self .assertTrue (any ("1.5.0" in str (warning .message ) for warning in w ))
466
- self .assertTrue (any ("1.7.0" in str (warning .message ) for warning in w ))
467
- self .assertTrue (any ("value_codecs" in str (warning .message ) for warning in w ))
468
466
469
467
def test_deprecated_count_compressor_warning (self ):
470
468
is_zarr_v3 = version_geq (get_package_version ("zarr" ), "3.0.0" )
469
+ codec_reg = numcodecs .registry .codec_registry
471
470
472
471
with warnings .catch_warnings (record = True ) as w :
473
472
warnings .simplefilter ("always" )
@@ -476,11 +475,11 @@ def test_deprecated_count_compressor_warning(self):
476
475
if is_zarr_v3 :
477
476
ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , count_codecs = ZARR_V3_LZ4_CODECS )
478
477
else :
479
- # For zarr v2, use string compressor
480
- ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , count_compressor = "LZ4" )
478
+ # For zarr v2, use Codec object
479
+ count_compressor = codec_reg ["lz4" ]()
480
+ ZarrAvgMerger (merged_shape = TENSOR_4x4 .shape , count_compressor = count_compressor )
481
481
482
482
# Only check for warnings under zarr v2
483
483
self .assertTrue (any ("count_compressor" in str (warning .message ) for warning in w ))
484
- self .assertTrue (any ("1.5.0" in str (warning .message ) for warning in w ))
485
- self .assertTrue (any ("1.7.0" in str (warning .message ) for warning in w ))
486
- self .assertTrue (any ("count_codecs" in str (warning .message ) for warning in w ))
484
+
485
+
0 commit comments