MCPcopy Index your code
hub / github.com/python/cpython / _assert_cycle

Method _assert_cycle

Lib/test/test_graphlib.py:29–39  ·  view source on GitHub ↗
(self, graph, cycle)

Source from the content-addressed store, hash-verified

27 self.assertEqual(set(group), tsgroup)
28
29 def _assert_cycle(self, graph, cycle):
30 ts = graphlib.TopologicalSorter()
31 for node, dependson in graph.items():
32 ts.add(node, *dependson)
33 try:
34 ts.prepare()
35 except graphlib.CycleError as e:
36 _, seq = e.args
37 self.assertIn(" ".join(map(str, cycle)), " ".join(map(str, seq * 2)))
38 else:
39 raise
40
41 def test_simple_cases(self):
42 self._test_graph(

Callers 1

test_cycleMethod · 0.95

Calls 5

addMethod · 0.95
prepareMethod · 0.95
assertInMethod · 0.80
itemsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected