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

Method test_dataset_pickle

xarray/tests/test_dask.py:746–762  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

744 assert not a2.coords["y"]._in_memory
745
746 def test_dataset_pickle(self):
747 # Test that pickling/unpickling converts the dask backend
748 # to numpy in neither the data variables nor the non-index coords
749 data = build_dask_array("data")
750 nonindex_coord = build_dask_array("coord")
751 ds1 = Dataset(data_vars={"a": ("x", data)}, coords={"y": ("x", nonindex_coord)})
752 ds1.compute()
753 assert not ds1["a"]._in_memory
754 assert not ds1["y"]._in_memory
755 assert kernel_call_count == 2
756 ds2 = pickle.loads(pickle.dumps(ds1))
757 assert kernel_call_count == 2
758 assert_identical(ds1, ds2)
759 assert not ds1["a"]._in_memory
760 assert not ds2["a"]._in_memory
761 assert not ds1["y"]._in_memory
762 assert not ds2["y"]._in_memory
763
764 def test_dataarray_getattr(self):
765 # ipython/jupyter does a long list of getattr() calls to when trying to

Callers

nothing calls this directly

Calls 4

computeMethod · 0.95
DatasetClass · 0.90
assert_identicalFunction · 0.90
build_dask_arrayFunction · 0.85

Tested by

no test coverage detected