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:2256–2286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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