()
| 104 | |
| 105 | |
| 106 | def test_two_node_cycle() -> None: |
| 107 | graph = dataflow.DirectedGraph() |
| 108 | graph.register_cell("0", parse_cell("x = y")) |
| 109 | graph.register_cell("1", parse_cell("y = x")) |
| 110 | errors = check_for_errors(graph) |
| 111 | assert set(errors.keys()) == {"0", "1"} |
| 112 | # Edge ordering in returned error is not deterministic, so we list both |
| 113 | # possible cycles |
| 114 | expected_cycle = [ |
| 115 | CycleError(edges_with_vars=(("0", ("x",), "1"), ("1", ("y",), "0"))), |
| 116 | CycleError(edges_with_vars=(("1", ("y",), "0"), ("0", ("x",), "1"))), |
| 117 | ] |
| 118 | assert len(errors["0"]) == 1 |
| 119 | assert len(errors["1"]) == 1 |
| 120 | assert errors["0"][0] in expected_cycle |
| 121 | assert errors["1"][0] in expected_cycle |
| 122 | |
| 123 | |
| 124 | def test_three_node_cycle() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…