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

Method assert_loads

xarray/tests/test_backends.py:547–558  ·  view source on GitHub ↗
(vars=None)

Source from the content-addressed store, hash-verified

545
546 @contextlib.contextmanager
547 def assert_loads(vars=None):
548 if vars is None:
549 vars = expected
550 with self.roundtrip(expected) as actual:
551 for k, v in actual.variables.items():
552 # IndexVariables are eagerly loaded into memory
553 assert v._in_memory == (k in actual.dims)
554 yield actual
555 for k, v in actual.variables.items():
556 if k in vars:
557 assert v._in_memory
558 assert_identical(expected, actual)
559
560 with pytest.raises(AssertionError):
561 # make sure the contextmanager works!

Callers

nothing calls this directly

Calls 3

roundtripMethod · 0.95
assert_identicalFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected