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

Function test_blockwise_fusion

dask/array/tests/test_array_core.py:6207–6222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6205
6206
6207def test_blockwise_fusion():
6208 def custom_scheduler_get(dsk, keys, **kwargs):
6209 """Custom scheduler that returns the result of the first key."""
6210 dsk = dsk.__dask_graph__()
6211 # two sum
6212 # one sum agg
6213 # one finalize Alias
6214 assert len(dsk) == 4, "False number of tasks"
6215 return [42 for _ in keys]
6216
6217 # First test that this mocking stuff works as expecged
6218 with pytest.raises(AssertionError, match="False number of tasks"):
6219 dask.compute(da.ones(10), scheduler=custom_scheduler_get)
6220
6221 a = ((da.ones(10, chunks=5) + 1) + 2).sum()
6222 dask.compute(a, scheduler=custom_scheduler_get)
6223
6224
6225@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 3

computeMethod · 0.45
onesMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected