MCPcopy Create free account
hub / github.com/dask/dask / test_zarr_group

Function test_zarr_group

dask/array/tests/test_array_core.py:5102–5121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5100
5101
5102def test_zarr_group():
5103 zarr = pytest.importorskip("zarr")
5104 with tmpdir() as d:
5105 a = da.zeros((3, 3), chunks=(1, 1))
5106 a.to_zarr(d, component="test")
5107 with pytest.raises((OSError, ValueError)):
5108 a.to_zarr(d, component="test", **{"overwrite": False})
5109 a.to_zarr(d, component="test", **{"overwrite": True})
5110
5111 # second time is fine, group exists
5112 a.to_zarr(d, component="test2", **{"overwrite": False})
5113 a.to_zarr(d, component="nested/test", **{"overwrite": False})
5114
5115 group = zarr.open_group(store=d, mode="r")
5116 assert set(group) == {"nested", "test", "test2"}
5117 assert "test" in group["nested"]
5118
5119 a2 = da.from_zarr(d, component="test")
5120 assert_eq(a, a2)
5121 assert a2.chunks == a.chunks
5122
5123
5124@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

tmpdirFunction · 0.90
assert_eqFunction · 0.90
setClass · 0.85
to_zarrMethod · 0.80
zerosMethod · 0.45

Tested by

no test coverage detected