Skip to content
Prev Previous commit
Next Next commit
Use assertRaisesRegex() to check TypeError message in test.
  • Loading branch information
barneygale committed Mar 5, 2023
commit 0ecae3d57bc60182dece7215ade883aa9bb1cd78
2 changes: 1 addition & 1 deletion Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_constructor_common(self):

def test_bytes(self):
P = self.cls
with self.assertRaises(TypeError):
with self.assertRaisesRegex(TypeError, "should be a str object or an os.PathLike object"):
P(b'a')
with self.assertRaises(TypeError):
P(b'a', 'b')
Expand Down