diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-04-26 03:40:59 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-04-26 03:40:59 (GMT) |
commit | f2b3f780a160347b0759b8d0f8ea9c41a456f724 (patch) | |
tree | 459bb689054d19a6cc78d46ddaa9c0ce6cc19222 /Lib/test/test_bytes.py | |
parent | 0fb5b398cddbf75a121b93680c8f9771f2e8499c (diff) | |
parent | ba42fd5801af664060dd90fccc4054b73967944c (diff) | |
download | cpython-f2b3f780a160347b0759b8d0f8ea9c41a456f724.zip cpython-f2b3f780a160347b0759b8d0f8ea9c41a456f724.tar.gz cpython-f2b3f780a160347b0759b8d0f8ea9c41a456f724.tar.bz2 |
#6780: merge with 3.1.
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 d074758..5eab8f5 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -303,6 +303,11 @@ class BaseBytesTest(unittest.TestCase): self.assertTrue(b.startswith(b"h")) self.assertFalse(b.startswith(b"hellow")) self.assertFalse(b.startswith(b"ha")) + with self.assertRaises(TypeError) as cm: + b.startswith([b'h']) + exc = str(cm.exception) + self.assertIn('bytes', exc) + self.assertIn('tuple', exc) def test_endswith(self): b = self.type2test(b'hello') @@ -312,6 +317,11 @@ class BaseBytesTest(unittest.TestCase): self.assertTrue(b.endswith(b"o")) self.assertFalse(b.endswith(b"whello")) self.assertFalse(b.endswith(b"no")) + with self.assertRaises(TypeError) as cm: + b.endswith([b'o']) + exc = str(cm.exception) + self.assertIn('bytes', exc) + self.assertIn('tuple', exc) def test_find(self): b = self.type2test(b'mississippi') |