(self)
| 114 | self._test_graph({}, []) |
| 115 | |
| 116 | def test_cycle(self): |
| 117 | # Self cycle |
| 118 | self._assert_cycle({1: {1}}, [1, 1]) |
| 119 | # Simple cycle |
| 120 | self._assert_cycle({1: {2}, 2: {1}}, [1, 2, 1]) |
| 121 | # Indirect cycle |
| 122 | self._assert_cycle({1: {2}, 2: {3}, 3: {1}}, [1, 3, 2, 1]) |
| 123 | # not all elements involved in a cycle |
| 124 | self._assert_cycle({1: {2}, 2: {3}, 3: {1}, 5: {4}, 4: {6}}, [1, 3, 2, 1]) |
| 125 | # Multiple cycles |
| 126 | self._assert_cycle({1: {2}, 2: {1}, 3: {4}, 4: {5}, 6: {7}, 7: {6}}, [1, 2, 1]) |
| 127 | # Cycle in the middle of the graph |
| 128 | self._assert_cycle({1: {2}, 2: {3}, 3: {2, 4}, 4: {5}}, [3, 2]) |
| 129 | |
| 130 | def test_calls_before_prepare(self): |
| 131 | ts = graphlib.TopologicalSorter() |
nothing calls this directly
no test coverage detected