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

Function test_zarr_entrypoint

xarray/tests/test_backends.py:7534–7555  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

7532
7533@requires_zarr
7534def test_zarr_entrypoint(tmp_path: Path) -> None:
7535 from xarray.backends.zarr import ZarrBackendEntrypoint
7536
7537 entrypoint = ZarrBackendEntrypoint()
7538 ds = create_test_data()
7539
7540 path = tmp_path / "foo.zarr"
7541 ds.to_zarr(path)
7542 _check_guess_can_open_and_open(entrypoint, path, engine="zarr", expected=ds)
7543 _check_guess_can_open_and_open(entrypoint, str(path), engine="zarr", expected=ds)
7544
7545 # add a trailing slash to the path and check again
7546 _check_guess_can_open_and_open(
7547 entrypoint, str(path) + "/", engine="zarr", expected=ds
7548 )
7549
7550 # Test the new functionality: .zarr with trailing slash
7551 assert entrypoint.guess_can_open("something-local.zarr")
7552 assert entrypoint.guess_can_open("something-local.zarr/") # With trailing slash
7553 assert not entrypoint.guess_can_open("something-local.nc")
7554 assert not entrypoint.guess_can_open("not-found-and-no-extension")
7555 assert not entrypoint.guess_can_open("something.zarr.txt")
7556
7557
7558@requires_h5netcdf

Callers

nothing calls this directly

Calls 5

guess_can_openMethod · 0.95
create_test_dataFunction · 0.85
to_zarrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…