MCPcopy
hub / github.com/django/django / test_iterative_dfs

Method test_iterative_dfs

tests/migrations/test_graph.py:177–194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

175 graph.ensure_not_cyclic()
176
177 def test_iterative_dfs(self):
178 graph = MigrationGraph()
179 root = ("app_a", "1")
180 graph.add_node(root, None)
181 expected = [root]
182 for i in range(2, 750):
183 parent = ("app_a", str(i - 1))
184 child = ("app_a", str(i))
185 graph.add_node(child, None)
186 graph.add_dependency(str(i), child, parent)
187 expected.append(child)
188 leaf = expected[-1]
189
190 forwards_plan = graph.forwards_plan(leaf)
191 self.assertEqual(expected, forwards_plan)
192
193 backwards_plan = graph.backwards_plan(root)
194 self.assertEqual(expected[::-1], backwards_plan)
195
196 def test_iterative_dfs_complexity(self):
197 """

Callers

nothing calls this directly

Calls 6

add_nodeMethod · 0.95
add_dependencyMethod · 0.95
forwards_planMethod · 0.95
backwards_planMethod · 0.95
MigrationGraphClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected