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

Function test_blockwise_numpy_args

dask/tests/test_distributed.py:604–618  ·  view source on GitHub ↗

Test pack/unpack of blockwise that includes a NumPy literal argument

(c, s, a, b)

Source from the content-addressed store, hash-verified

602
603@gen_cluster(client=True)
604async def test_blockwise_numpy_args(c, s, a, b):
605 """Test pack/unpack of blockwise that includes a NumPy literal argument"""
606 pytest.importorskip("numpy")
607 da = pytest.importorskip("dask.array")
608 np = pytest.importorskip("numpy")
609
610 def fn(x, dt):
611 assert type(dt) is np.uint16
612 return x.astype(dt)
613
614 arr = da.blockwise(
615 fn, "x", da.ones(1000), "x", np.uint16(42), None, dtype=np.uint16
616 )
617 res = await c.compute(arr.sum(), optimize_graph=False)
618 assert res == 1000
619
620
621@gen_cluster(client=True)

Callers

nothing calls this directly

Calls 3

onesMethod · 0.45
computeMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected