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

Function test_blockwise_numpy_kwargs

dask/tests/test_distributed.py:622–634  ·  view source on GitHub ↗

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

(c, s, a, b)

Source from the content-addressed store, hash-verified

620
621@gen_cluster(client=True)
622async def test_blockwise_numpy_kwargs(c, s, a, b):
623 """Test pack/unpack of blockwise that includes a NumPy literal keyword argument"""
624 pytest.importorskip("numpy")
625 da = pytest.importorskip("dask.array")
626 np = pytest.importorskip("numpy")
627
628 def fn(x, dt=None):
629 assert type(dt) is np.uint16
630 return x.astype(dt)
631
632 arr = da.blockwise(fn, "x", da.ones(1000), "x", dtype=np.uint16, dt=np.uint16(42))
633 res = await c.compute(arr.sum(), optimize_graph=False)
634 assert res == 1000
635
636
637def test_blockwise_different_optimization(c):

Callers

nothing calls this directly

Calls 3

onesMethod · 0.45
computeMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected