MCPcopy
hub / github.com/marimo-team/marimo / test_two_node_cycle

Function test_two_node_cycle

tests/_lint/test_validate_graph.py:106–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104
105
106def 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
124def test_three_node_cycle() -> None:

Callers

nothing calls this directly

Calls 4

register_cellMethod · 0.95
check_for_errorsFunction · 0.90
CycleErrorClass · 0.90
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…