summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-12 22:05:42 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-12 22:05:42 (GMT)
commitf845302d06542c2a3a52a9356c09d54ecbf44610 (patch)
tree20a649b936a59d6fbbb914e60da53a3f7e58c5f3 /Lib/test/test_bytes.py
parenta515bab035ef19e923e781171115c4a3a7f4e8fe (diff)
downloadcpython-f845302d06542c2a3a52a9356c09d54ecbf44610.zip
cpython-f845302d06542c2a3a52a9356c09d54ecbf44610.tar.gz
cpython-f845302d06542c2a3a52a9356c09d54ecbf44610.tar.bz2
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. ........
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 30000bd..f844628 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -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):