diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-03 11:42:17 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-03 11:42:17 (GMT) |
commit | 6c94d10a193ffdaad9d3b7c2376d9f4de776575f (patch) | |
tree | 4910d3b8512256ee95749b0ce863e512b4d55eed /Lib/test/test_bytes.py | |
parent | e09132f2c764a9e7df1181b1999d517d949c99e6 (diff) | |
parent | af65872da2b679e4b1876412aab6a731f82a469f (diff) | |
download | cpython-6c94d10a193ffdaad9d3b7c2376d9f4de776575f.zip cpython-6c94d10a193ffdaad9d3b7c2376d9f4de776575f.tar.gz cpython-6c94d10a193ffdaad9d3b7c2376d9f4de776575f.tar.bz2 |
Issue #27443: __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
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 9d878ca..05dc26a 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -1328,6 +1328,16 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase): test_exhausted_iterator = test.list_tests.CommonTest.test_exhausted_iterator + def test_iterator_length_hint(self): + # Issue 27443: __length_hint__ can return negative integer + ba = bytearray(b'ab') + it = iter(ba) + next(it) + ba.clear() + # Shouldn't raise an error + self.assertEqual(list(it), []) + + class AssortedBytesTest(unittest.TestCase): # # Test various combinations of bytes and bytearray |