Issue #27039: Fixed bytearray.remove() for values greater than 127.

Based on patch by Joe Jevnik.
This commit is contained in:
Serhiy Storchaka 2016-05-16 22:24:03 +03:00
commit 4b23494ded
4 changed files with 115 additions and 108 deletions

View file

@ -1177,6 +1177,13 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
b.remove(Indexable(ord('e')))
self.assertEqual(b, b'')
# test values outside of the ascii range: (0, 127)
c = bytearray([126, 127, 128, 129])
c.remove(127)
self.assertEqual(c, bytes([126, 128, 129]))
c.remove(129)
self.assertEqual(c, bytes([126, 128]))
def test_pop(self):
b = bytearray(b'world')
self.assertEqual(b.pop(), ord('d'))