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

Method test_persist

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

Source from the content-addressed store, hash-verified

295 assert ((u + 1).data == v2.data).all()
296
297 def test_persist(self):
298 u = self.eager_var
299 v = self.lazy_var + 1
300
301 (v2,) = dask.persist(v)
302 assert v is not v2
303 assert len(v2.__dask_graph__()) < len(v.__dask_graph__()) # type: ignore[arg-type]
304 assert v2.__dask_keys__() == v.__dask_keys__()
305 assert dask.is_dask_collection(v)
306 assert dask.is_dask_collection(v2)
307
308 self.assertLazyAndAllClose(u + 1, v)
309 self.assertLazyAndAllClose(u + 1, v2)
310
311 @requires_pint
312 def test_tokenize_duck_dask_array(self):

Callers

nothing calls this directly

Calls 4

assertLazyAndAllCloseMethod · 0.95
persistMethod · 0.45
__dask_graph__Method · 0.45
__dask_keys__Method · 0.45

Tested by

no test coverage detected