MCPcopy
hub / github.com/dask/dask / test_blockwise_array_creation

Function test_blockwise_array_creation

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…