()
| 30 | |
| 31 | |
| 32 | def test_graph_two_chains() -> None: |
| 33 | graph = dataflow.DirectedGraph() |
| 34 | code = "x = 0" |
| 35 | first_cell = parse_cell(code) |
| 36 | graph.register_cell("0", first_cell) |
| 37 | |
| 38 | code = "y = x" |
| 39 | second_cell = parse_cell(code) |
| 40 | graph.register_cell("1", second_cell) |
| 41 | |
| 42 | code = "z = y\nzz = x" |
| 43 | third_cell = parse_cell(code) |
| 44 | graph.register_cell("2", third_cell) |
| 45 | |
| 46 | # 0 --> 1 --> 2, 0 --> 2 |
| 47 | assert graph.cells == {"0": first_cell, "1": second_cell, "2": third_cell} |
| 48 | assert graph.parents == {"0": set(), "1": {"0"}, "2": {"0", "1"}} |
| 49 | assert graph.children == { |
| 50 | "0": {"1", "2"}, |
| 51 | "1": {"2"}, |
| 52 | "2": set(), |
| 53 | } |
| 54 | |
| 55 | |
| 56 | def test_graph_unconnected() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…