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

Method test_done

Lib/test/test_graphlib.py:170–190  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

168 ts.done(24)
169
170 def test_done(self):
171 ts = graphlib.TopologicalSorter()
172 ts.add(1, 2, 3, 4)
173 ts.add(2, 3)
174 ts.prepare()
175
176 self.assertEqual(ts.get_ready(), (3, 4))
177 # If we don't mark anything as done, get_ready() returns nothing
178 self.assertEqual(ts.get_ready(), ())
179 ts.done(3)
180 # Now 2 becomes available as 3 is done
181 self.assertEqual(ts.get_ready(), (2,))
182 self.assertEqual(ts.get_ready(), ())
183 ts.done(4)
184 ts.done(2)
185 # Only 1 is missing
186 self.assertEqual(ts.get_ready(), (1,))
187 self.assertEqual(ts.get_ready(), ())
188 ts.done(1)
189 self.assertEqual(ts.get_ready(), ())
190 self.assertFalse(ts.is_active())
191
192 def test_is_active(self):
193 ts = graphlib.TopologicalSorter()

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
prepareMethod · 0.95
get_readyMethod · 0.95
doneMethod · 0.95
is_activeMethod · 0.95
assertFalseMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected