MCPcopy
hub / github.com/django/django / test_circular_graph

Method test_circular_graph

tests/migrations/test_graph.py:145–163  ·  view source on GitHub ↗

Tests a circular dependency graph.

(self)

Source from the content-addressed store, hash-verified

143 )
144
145 def test_circular_graph(self):
146 """
147 Tests a circular dependency graph.
148 """
149 # Build graph
150 graph = MigrationGraph()
151 graph.add_node(("app_a", "0001"), None)
152 graph.add_node(("app_a", "0002"), None)
153 graph.add_node(("app_a", "0003"), None)
154 graph.add_node(("app_b", "0001"), None)
155 graph.add_node(("app_b", "0002"), None)
156 graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_a", "0002"))
157 graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001"))
158 graph.add_dependency("app_a.0001", ("app_a", "0001"), ("app_b", "0002"))
159 graph.add_dependency("app_b.0002", ("app_b", "0002"), ("app_b", "0001"))
160 graph.add_dependency("app_b.0001", ("app_b", "0001"), ("app_a", "0003"))
161 # Test whole graph
162 with self.assertRaises(CircularDependencyError):
163 graph.ensure_not_cyclic()
164
165 def test_circular_graph_2(self):
166 graph = MigrationGraph()

Callers

nothing calls this directly

Calls 4

add_nodeMethod · 0.95
add_dependencyMethod · 0.95
ensure_not_cyclicMethod · 0.95
MigrationGraphClass · 0.90

Tested by

no test coverage detected