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

Method test_dataset_caching

xarray/tests/test_backends.py:647–659  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

645 assert_identical(expected["foo"], unpickled)
646
647 def test_dataset_caching(self) -> None:
648 expected = Dataset({"foo": ("x", [5, 6, 7])})
649 with self.roundtrip(expected) as actual:
650 assert isinstance(actual.foo.variable._data, indexing.MemoryCachedArray)
651 assert not actual.foo.variable._in_memory
652 _ = actual.foo.values # cache
653 assert actual.foo.variable._in_memory
654
655 with self.roundtrip(expected, open_kwargs={"cache": False}) as actual:
656 assert isinstance(actual.foo.variable._data, indexing.CopyOnWriteArray)
657 assert not actual.foo.variable._in_memory
658 _ = actual.foo.values # no caching
659 assert not actual.foo.variable._in_memory
660
661 def test_roundtrip_None_variable(self) -> None:
662 expected = Dataset({None: (("x", "y"), [[0, 1], [2, 3]])})

Callers

nothing calls this directly

Calls 2

roundtripMethod · 0.95
DatasetClass · 0.90

Tested by

no test coverage detected