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

Function test_inline

dask/tests/test_optimization.py:247–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

245
246
247def test_inline():
248 d = {"a": 1, "b": (inc, "a"), "c": (inc, "b"), "d": (add, "a", "c")}
249 assert inline(d) == {"a": 1, "b": (inc, 1), "c": (inc, "b"), "d": (add, 1, "c")}
250 assert inline(d, ["a", "b", "c"]) == {
251 "a": 1,
252 "b": (inc, 1),
253 "c": (inc, (inc, 1)),
254 "d": (add, 1, (inc, (inc, 1))),
255 }
256 d = {"x": 1, "y": (inc, "x"), "z": (add, "x", "y")}
257 assert inline(d) == {"x": 1, "y": (inc, 1), "z": (add, 1, "y")}
258 assert inline(d, keys="y") == {"x": 1, "y": (inc, 1), "z": (add, 1, (inc, 1))}
259 assert inline(d, keys="y", inline_constants=False) == {
260 "x": 1,
261 "y": (inc, "x"),
262 "z": (add, "x", (inc, "x")),
263 }
264
265 d = {"a": 1, "b": "a", "c": "b", "d": ["a", "b", "c"], "e": (add, (len, "d"), "a")}
266 assert inline(d, "d") == {
267 "a": 1,
268 "b": 1,
269 "c": 1,
270 "d": [1, 1, 1],
271 "e": (add, (len, [1, 1, 1]), 1),
272 }
273 assert inline(d, "a", inline_constants=False) == {
274 "a": 1,
275 "b": 1,
276 "c": "b",
277 "d": [1, "b", "c"],
278 "e": (add, (len, "d"), 1),
279 }
280
281
282def test_inline_functions():

Callers

nothing calls this directly

Calls 1

inlineFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…