Test pack/unpack of blockwise that includes a NumPy literal keyword argument
(c, s, a, b)
| 620 | |
| 621 | @gen_cluster(client=True) |
| 622 | async 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 | |
| 637 | def test_blockwise_different_optimization(c): |