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

Method test_iterator_pickling_overflowing_index

Lib/test/test_range.py:406–413  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

404 self.assertEqual(list(it), data[1:])
405
406 def test_iterator_pickling_overflowing_index(self):
407 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
408 with self.subTest(proto=proto):
409 it = iter(range(2**32 + 2))
410 it.__setstate__(2**32 + 1) # undocumented way to advance an iterator
411 d = pickle.dumps(it, proto)
412 it = pickle.loads(d)
413 self.assertEqual(next(it), 2**32 + 1)
414
415 def test_exhausted_iterator_pickling(self):
416 for proto in range(pickle.HIGHEST_PROTOCOL + 1):

Callers

nothing calls this directly

Calls 5

subTestMethod · 0.45
__setstate__Method · 0.45
dumpsMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected