diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-03-30 18:02:00 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-03-30 18:02:00 (GMT) |
commit | 0ed3891915425b1af26e26c4c5d350e85e7ea4cf (patch) | |
tree | 38862612aaa28e4ebbb3fd4138b13787b725e215 /Lib/test/test_bytes.py | |
parent | 14a7d6389fb453cca18d61bbe39deff7062bc66f (diff) | |
download | cpython-0ed3891915425b1af26e26c4c5d350e85e7ea4cf.zip cpython-0ed3891915425b1af26e26c4c5d350e85e7ea4cf.tar.gz cpython-0ed3891915425b1af26e26c4c5d350e85e7ea4cf.tar.bz2 |
Issue #26492: Added additional tests for exhausted iterators of mutable sequences.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r-- | Lib/test/test_bytes.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 82ad451..bdcb88a 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -900,6 +900,16 @@ class ByteArrayTest(BaseBytesTest): # PyByteArray_AS_STRING() C macro. self.assertRaises(ValueError, int, bytearray(b'')) + def test_exhausted_iterator(self): + a = self.type2test([1, 2, 3]) + exhit = iter(a) + empit = iter(a) + for x in exhit: # exhaust the iterator + next(empit) # not exhausted + a.append(9) + self.assertEqual(list(exhit), []) + self.assertEqual(list(empit), [9]) + self.assertEqual(a, self.type2test([1, 2, 3, 9])) class AssortedBytesTest(unittest.TestCase): # |