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

Function test_fuse_roots_annotations

dask/array/tests/test_optimization.py:231–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229
230
231def test_fuse_roots_annotations():
232 x = da.ones(10, chunks=(2,))
233 y = da.zeros(10, chunks=(2,))
234
235 with dask.annotate(foo="bar"):
236 y = y**2
237
238 z = (x + 1) + (2 * y)
239 hlg = dask.blockwise.optimize_blockwise(z.dask)
240 assert len(hlg.layers) == 3
241 assert {"foo": "bar"} in [l.annotations for l in hlg.layers.values()]
242 za = da.Array(hlg, z.name, z.chunks, z.dtype)
243 assert_eq(za, z)
244
245
246@pytest.mark.parametrize("optimize_graph", [True, False])

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
onesMethod · 0.45
zerosMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected