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

Method test_write_region_mode

xarray/tests/test_backends.py:3517–3527  ·  view source on GitHub ↗
(self, mode)

Source from the content-addressed store, hash-verified

3515
3516 @pytest.mark.parametrize("mode", [None, "r+", "a"])
3517 def test_write_region_mode(self, mode) -> None:
3518 zeros = Dataset({"u": (("x",), np.zeros(10))})
3519 nonzeros = Dataset({"u": (("x",), np.arange(1, 11))})
3520 with self.create_zarr_target() as store:
3521 zeros.to_zarr(store, **self.version_kwargs)
3522 for region in [{"x": slice(5)}, {"x": slice(5, 10)}]:
3523 nonzeros.isel(region).to_zarr(
3524 store, region=region, mode=mode, **self.version_kwargs
3525 )
3526 with xr.open_zarr(store, **self.version_kwargs) as actual:
3527 assert_identical(actual, nonzeros)
3528
3529 @requires_dask
3530 def test_write_preexisting_override_metadata(self) -> None:

Callers

nothing calls this directly

Calls 6

create_zarr_targetMethod · 0.95
to_zarrMethod · 0.95
iselMethod · 0.95
DatasetClass · 0.90
assert_identicalFunction · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected