def test_GraphIndex_multigraph(): def helper(x): return x * x @parse def f(x, y): def inner(a): b = a - 1000 return b a = inner(x) * helper(y) return a idx = GraphIndex(f) assert idx.get_all("x") == { idx["f"].parameters[0], idx["helper"].parameters[0], } assert idx.get_all("y") == {idx["f"].parameters[1]} assert idx.get_all("a") == {idx["f"].output, idx["inner"].parameters[0]} assert idx.get_all("b") == {idx["inner"].output}
def test_GraphIndex_multigraph(): def helper(x): return x * x @parse def f(x, y): def inner(a): b = a - 1000 return b a = inner(x) * helper(y) return a idx = GraphIndex(f) assert idx.get_all('x') == {idx['f'].parameters[0], idx['helper'].parameters[0]} assert idx.get_all('y') == {idx['f'].parameters[1]} assert idx.get_all('a') == {idx['f'].output, idx['inner'].parameters[0]} assert idx.get_all('b') == {idx['inner'].output}