MCPcopy Index your code
hub / github.com/pydata/xarray / test_shard_encoding

Method test_shard_encoding

xarray/tests/test_backends.py:2905–2921  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2903 pass
2904
2905 def test_shard_encoding(self) -> None:
2906 # These datasets have no dask chunks. All chunking/sharding specified in
2907 # encoding
2908 if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3:
2909 data = create_test_data()
2910 chunks = (1, 1)
2911 shards = (5, 5)
2912 data["var2"].encoding.update({"chunks": chunks})
2913 data["var2"].encoding.update({"shards": shards})
2914 with self.roundtrip(data) as actual:
2915 assert shards == actual["var2"].encoding["shards"]
2916
2917 # expect an error with shards not divisible by chunks
2918 data["var2"].encoding.update({"chunks": (2, 2)})
2919 with pytest.raises(ValueError):
2920 with self.roundtrip(data) as actual:
2921 pass
2922
2923 @requires_dask
2924 def test_shard_encoding_with_dask(self) -> None:

Callers

nothing calls this directly

Calls 3

roundtripMethod · 0.95
create_test_dataFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected