mirror of https://github.com/python/cpython
Merged revisions 77448 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77448 | antoine.pitrou | 2010-01-12 23:02:10 +0100 (mar., 12 janv. 2010) | 3 lines Issue #7654: enable additional bytes/bytearray tests. Patch by Florent Xicluna. ........
This commit is contained in:
parent
a515bab035
commit
f845302d06
|
@ -277,13 +277,6 @@ class BaseBytesTest(unittest.TestCase):
|
|||
self.assertEqual(self.type2test(b".").join([b"ab", b"cd"]), b"ab.cd")
|
||||
# XXX more...
|
||||
|
||||
def test_index(self):
|
||||
b = self.type2test(b'parrot')
|
||||
self.assertEqual(b.index('p'), 0)
|
||||
self.assertEqual(b.index('rr'), 2)
|
||||
self.assertEqual(b.index('t'), 5)
|
||||
self.assertRaises(ValueError, lambda: b.index('w'))
|
||||
|
||||
def test_count(self):
|
||||
b = self.type2test(b'mississippi')
|
||||
self.assertEqual(b.count(b'i'), 4)
|
||||
|
@ -369,6 +362,10 @@ class BaseBytesTest(unittest.TestCase):
|
|||
def test_split_string_error(self):
|
||||
self.assertRaises(TypeError, self.type2test(b'a b').split, ' ')
|
||||
|
||||
def test_split_unicodewhitespace(self):
|
||||
b = self.type2test(b"\x09\x0A\x0B\x0C\x0D\x1C\x1D\x1E\x1F")
|
||||
self.assertEqual(b.split(), [b'\x1c\x1d\x1e\x1f'])
|
||||
|
||||
def test_rsplit(self):
|
||||
b = self.type2test(b'mississippi')
|
||||
self.assertEqual(b.rsplit(b'i'), [b'm', b'ss', b'ss', b'pp', b''])
|
||||
|
@ -392,18 +389,18 @@ class BaseBytesTest(unittest.TestCase):
|
|||
|
||||
def test_rsplit_unicodewhitespace(self):
|
||||
b = self.type2test(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'])
|
||||
|
||||
def test_partition(self):
|
||||
b = self.type2test(b'mississippi')
|
||||
self.assertEqual(b.partition(b'ss'), (b'mi', b'ss', b'issippi'))
|
||||
self.assertEqual(b.rpartition(b'w'), (b'', b'', b'mississippi'))
|
||||
self.assertEqual(b.partition(b'w'), (b'mississippi', b'', b''))
|
||||
|
||||
def test_rpartition(self):
|
||||
b = self.type2test(b'mississippi')
|
||||
self.assertEqual(b.rpartition(b'ss'), (b'missi', b'ss', b'ippi'))
|
||||
self.assertEqual(b.rpartition(b'i'), (b'mississipp', b'i', b''))
|
||||
self.assertEqual(b.rpartition(b'w'), (b'', b'', b'mississippi'))
|
||||
|
||||
def test_pickling(self):
|
||||
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
|
||||
|
|
Loading…
Reference in New Issue