MCPcopy
hub / github.com/dask/dask / test_annotations_survive_optimization

Function test_annotations_survive_optimization

dask/tests/test_delayed.py:880–896  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

878
879
880def test_annotations_survive_optimization():
881 with dask.annotate(foo="bar"):
882 graph = HighLevelGraph.from_collections(
883 "b",
884 {"a": 1, "b": (inc, "a"), "c": (inc, "b")},
885 [],
886 )
887 d = Delayed("b", graph)
888
889 assert type(d.dask) is HighLevelGraph
890 assert len(d.dask.layers) == 1
891 assert len(d.dask.layers["b"]) == 3
892 assert d.dask.layers["b"].annotations == {"foo": "bar"}
893 optimized = collections_to_expr([d]).optimize()
894 assert optimized.__dask_annotations__() == {
895 "foo": dict.fromkeys(optimized.__dask_graph__(), "bar")
896 }
897
898
899def test_delayed_function_attributes_forwarded():

Callers

nothing calls this directly

Calls 6

DelayedClass · 0.90
collections_to_exprFunction · 0.90
from_collectionsMethod · 0.80
optimizeMethod · 0.45
__dask_annotations__Method · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…