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

Method test_mutating_seq_class_exhausted_iter

Lib/test/test_iter.py:241–250  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

239 self.assertEqual(list(it), [])
240
241 def test_mutating_seq_class_exhausted_iter(self):
242 a = SequenceClass(5)
243 exhit = iter(a)
244 empit = iter(a)
245 for x in exhit: # exhaust the iterator
246 next(empit) # not exhausted
247 a.n = 7
248 self.assertEqual(list(exhit), [])
249 self.assertEqual(list(empit), [5, 6])
250 self.assertEqual(list(a), [0, 1, 2, 3, 4, 5, 6])
251
252 def test_reduce_mutating_builtins_iter(self):
253 # This is a reproducer of issue #101765

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.95
listClass · 0.85
SequenceClassClass · 0.70

Tested by

no test coverage detected