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

Function test_blockwise_array_creation

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

Source from the content-addressed store, hash-verified

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