Skip to content

Commit 4a85fcd

Browse files
dcherianmpiannucci
andcommitted
fix compressors
Co-authored-by: Matthew Iannucci <mpiannucci@users.noreply.github.com>
1 parent ffeb009 commit 4a85fcd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

xarray/tests/test_backends.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,18 +2675,15 @@ def test_write_persistence_modes(self, group) -> None:
26752675
assert_identical(original, actual)
26762676

26772677
def test_compressor_encoding(self) -> None:
2678-
from numcodecs.blosc import Blosc
2679-
2680-
original = create_test_data()
26812678
# specify a custom compressor
2682-
2679+
original = create_test_data()
26832680
if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3:
26842681
encoding_key = "compressors"
26852682
# all parameters need to be explicitly specified in order for the comparison to pass below
26862683
encoding = {
26872684
"serializer": zarr.codecs.BytesCodec(endian="little"),
26882685
encoding_key: (
2689-
Blosc(
2686+
zarr.codecs.BloscCodec(
26902687
cname="zstd",
26912688
clevel=3,
26922689
shuffle="shuffle",
@@ -2696,8 +2693,11 @@ def test_compressor_encoding(self) -> None:
26962693
),
26972694
}
26982695
else:
2696+
from numcodecs.blosc import Blosc
2697+
26992698
encoding_key = "compressors" if has_zarr_v3 else "compressor"
2700-
encoding = {encoding_key: (Blosc(cname="zstd", clevel=3, shuffle=2),)}
2699+
comp = Blosc(cname="zstd", clevel=3, shuffle=2)
2700+
encoding = {encoding_key: (comp,) if has_zarr_v3 else comp}
27012701

27022702
save_kwargs = dict(encoding={"var1": encoding})
27032703

0 commit comments

Comments
 (0)