Skip to content

Commit

Permalink
Adds test for closing a zarr store created internally
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlAndersson committed Nov 10, 2023
1 parent 33f742b commit 155ceb0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -5431,3 +5431,13 @@ def test_raise_writing_to_nczarr(self, mode) -> None:
def test_pickle_open_mfdataset_dataset():
ds = open_example_mfdataset(["bears.nc"])
assert_identical(ds, pickle.loads(pickle.dumps(ds)))


@requires_zarr
def test_zarr_closing_internal_zip_store():
store_name = "tmp.zarr.zip"
original_da = DataArray(np.arange(12).reshape((3, 4)))
original_da.to_zarr(store_name, mode="w")

with open_dataarray(store_name, engine="zarr") as loaded_da:
assert_identical(original_da, loaded_da)

0 comments on commit 155ceb0

Please sign in to comment.