MCPcopy Create free account
hub / github.com/dask/dask / test_store_compute_false

Function test_store_compute_false

dask/array/tests/test_array_core.py:2254–2284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2252
2253
2254def test_store_compute_false():
2255 d = da.ones((4, 4), chunks=(2, 2))
2256 a, b = d + 1, d + 2
2257
2258 at = np.zeros(shape=(4, 4))
2259 bt = np.zeros(shape=(4, 4))
2260
2261 v = store([a, b], [at, bt], compute=False)
2262
2263 assert (at == 0).all() and (bt == 0).all()
2264 results = dask.compute(*v)
2265 assert all([ev.size == 0 for ev in results])
2266 assert (at == 2).all() and (bt == 3).all()
2267
2268 at = np.zeros(shape=(4, 4))
2269 bt = np.zeros(shape=(4, 4))
2270 dat, dbt = store([a, b], [at, bt], compute=False, return_stored=True)
2271 assert isinstance(dat, Array) and isinstance(dbt, Array)
2272 assert (at == 0).all() and (bt == 0).all()
2273 assert (dat.compute() == at).all() and (dbt.compute() == bt).all()
2274 assert (at == 2).all() and (bt == 3).all()
2275
2276 at = np.zeros(shape=(4, 4))
2277 bt = np.zeros(shape=(4, 4))
2278 dat, dbt = store(
2279 [a, b], [at, bt], compute=False, return_stored=True, load_stored=False
2280 )
2281 assert isinstance(dat, Array) and isinstance(dbt, Array)
2282 assert (at == 0).all() and (bt == 0).all()
2283 dask.compute(dat, dbt)
2284 assert (at == 2).all() and (bt == 3).all()
2285
2286
2287def test_store_nocompute_regions():

Callers

nothing calls this directly

Calls 6

storeFunction · 0.90
allFunction · 0.85
onesMethod · 0.45
zerosMethod · 0.45
allMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected