diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-30 09:51:48 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-30 09:51:48 (GMT) |
commit | 7b876158dc8a69e030d09e6cf78a1e8b6662f0c3 (patch) | |
tree | 4609dc87147ebfeb9d78d3ddf2be20f681109703 /Lib/test/test_bytes.py | |
parent | d4cb56d4e88c7e001bbaba2c80953db47632f199 (diff) | |
download | cpython-7b876158dc8a69e030d09e6cf78a1e8b6662f0c3.zip cpython-7b876158dc8a69e030d09e6cf78a1e8b6662f0c3.tar.gz cpython-7b876158dc8a69e030d09e6cf78a1e8b6662f0c3.tar.bz2 |
Fixed #1969: split and rsplit in bytearray are inconsistent
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r-- | Lib/test/test_bytes.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 0fd2f76..40082c3 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -706,7 +706,7 @@ class BytesTest(unittest.TestCase): self.assertEqual(b.rsplit(None, 2), [b'arf', b'barf']) self.assertEqual(b' a bb c '.rsplit(None, 0), [b' a bb c']) self.assertEqual(b' a bb c '.rsplit(None, 1), [b' a bb', b'c']) - self.assertEqual(b' a bb c '.rsplit(None,2), [b' a', b'bb', b'c']) + self.assertEqual(b' a bb c '.rsplit(None, 2), [b' a', b'bb', b'c']) self.assertEqual(b' a bb c '.rsplit(None, 3), [b'a', b'bb', b'c']) def test_rsplit_bytearray(self): @@ -715,6 +715,15 @@ class BytesTest(unittest.TestCase): def test_rsplit_string_error(self): self.assertRaises(TypeError, b'a b'.rsplit, ' ') + def test_rsplit_unicodewhitespace(self): + b = b"\x09\x0A\x0B\x0C\x0D\x1C\x1D\x1E\x1F" + self.assertEqual(b.split(), [b'\x1c\x1d\x1e\x1f']) + self.assertEqual(b.rsplit(), [b'\x1c\x1d\x1e\x1f']) + ba = bytearray(b) + self.assertEqual(ba.split(), [bytearray(b'\x1c\x1d\x1e\x1f')]) + self.assertEqual(ba.rsplit(), [bytearray(b'\x1c\x1d\x1e\x1f')]) + + def test_partition(self): b = b'mississippi' self.assertEqual(b.partition(b'ss'), (b'mi', b'ss', b'issippi')) |