diff options
Diffstat (limited to 'Lib/test/test_posixpath.py')
-rw-r--r-- | Lib/test/test_posixpath.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index a7a3e4aa12..54de0cf516 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -56,8 +56,15 @@ class PosixPathTest(unittest.TestCase): self.assertEqual(posixpath.join(b"/foo/", b"bar/", b"baz/"), b"/foo/bar/baz/") - self.assertRaises(TypeError, posixpath.join, b"bytes", "str") - self.assertRaises(TypeError, posixpath.join, "str", b"bytes") + with self.assertRaises(TypeError) as e: + posixpath.join(b'bytes', 'str') + self.assertIn("Can't mix strings and bytes", e.args[0]) + with self.assertRaises(TypeError) as e: + posixpath.join('str', b'bytes') + self.assertIn("Can't mix strings and bytes", e.args[0]) + with self.assertRaises(TypeError) as e: + posixpath.join('str', bytearray(b'bytes')) + self.assertIn("Can't mix strings and bytes", e.args[0]) def test_split(self): self.assertEqual(posixpath.split("/foo/bar"), ("/foo", "bar")) |