Skip to content

Commit 72fd944

Browse files
committed
one more compressor fix
1 parent 4a85fcd commit 72fd944

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

xarray/tests/test_backends.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,9 +2841,12 @@ def test_check_encoding_is_consistent_after_append(self) -> None:
28412841
import numcodecs
28422842

28432843
encoding_value: Any
2844-
compressor = numcodecs.Blosc()
2844+
if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3:
2845+
compressor = zarr.codecs.BloscCodec()
2846+
else:
2847+
compressor = numcodecs.Blosc()
28452848
encoding_key = "compressors" if has_zarr_v3 else "compressor"
2846-
encoding_value = compressor
2849+
encoding_value = (compressor,) if has_zarr_v3 else compressor
28472850

28482851
encoding = {"da": {encoding_key: encoding_value}}
28492852
ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs)
@@ -5469,7 +5472,7 @@ def test_dataarray_to_netcdf_no_name_pathlib(self) -> None:
54695472
@requires_zarr
54705473
class TestDataArrayToZarr:
54715474
def skip_if_zarr_python_3_and_zip_store(self, store) -> None:
5472-
if has_zarr_v3 and isinstance(store, zarr.storage.zip.ZipStore):
5475+
if has_zarr_v3 and isinstance(store, zarr.storage.ZipStore):
54735476
pytest.skip(
54745477
reason="zarr-python 3.x doesn't support reopening ZipStore with a new mode."
54755478
)

0 commit comments

Comments
 (0)