MCPcopy
hub / github.com/dask/dask / test_store_compute_false

Function test_store_compute_false

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…