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

Function test_blockwise_array_creation

dask/tests/test_distributed.py:490–514  ·  view source on GitHub ↗
(c, io, fuse)

Source from the content-addressed store, hash-verified

488)
489@pytest.mark.parametrize("fuse", [True, False, None])
490def test_blockwise_array_creation(c, io, fuse):
491 np = pytest.importorskip("numpy")
492 da = pytest.importorskip("dask.array")
493
494 chunks = (5, 2)
495 shape = (10, 4)
496
497 if io == "ones":
498 darr = da.ones(shape, chunks=chunks)
499 narr = np.ones(shape)
500 elif io == "zeros":
501 darr = da.zeros(shape, chunks=chunks)
502 narr = np.zeros(shape)
503 elif io == "full":
504 darr = da.full(shape, 10, chunks=chunks)
505 narr = np.full(shape, 10)
506
507 darr += 2
508 narr += 2
509 with dask.config.set({"optimization.fuse.active": fuse}):
510 darr.compute()
511 dsk = dask.array.optimize(darr.dask, darr.__dask_keys__())
512 # dsk should be a dict unless fuse is explicitly False
513 assert isinstance(dsk, dict) == (fuse is not False)
514 da.assert_eq(darr, narr, scheduler=c)
515
516
517@ignore_sync_scheduler_warning

Callers

nothing calls this directly

Calls 7

setMethod · 0.80
onesMethod · 0.45
zerosMethod · 0.45
fullMethod · 0.45
computeMethod · 0.45
optimizeMethod · 0.45
__dask_keys__Method · 0.45

Tested by

no test coverage detected