MCPcopy
hub / github.com/pydata/xarray / assert_expected_files

Method assert_expected_files

xarray/tests/test_backends.py:4507–4523  ·  view source on GitHub ↗

Convenience for comparing with actual files written

(expected: list[str], store: str)

Source from the content-addressed store, hash-verified

4505 write_empty: bool | None,
4506 ) -> None:
4507 def assert_expected_files(expected: list[str], store: str) -> None:
4508 """Convenience for comparing with actual files written"""
4509 ls = []
4510 test_root = os.path.join(store, "test")
4511 for root, _, files in os.walk(test_root):
4512 ls.extend(
4513 [
4514 os.path.join(root, f).removeprefix(test_root).lstrip("/")
4515 for f in files
4516 ]
4517 )
4518
4519 assert set(expected) == {
4520 file.lstrip("c/")
4521 for file in ls
4522 if (file not in (".zattrs", ".zarray", "zarr.json"))
4523 }
4524
4525 # The zarr format is set by the `default_zarr_format`
4526 # pytest fixture that acts on a superclass

Callers

nothing calls this directly

Calls 2

lstripMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected