@@ -3311,20 +3311,12 @@ def test_path_t_converter(self):
|
3311 | 3311 | fn(fd, *extra_args) |
3312 | 3312 | |
3313 | 3313 | def test_path_t_converter_and_custom_class(self): |
3314 | | -with self.assertRaisesRegex( |
3315 | | -TypeError, |
3316 | | -'__fspath__\(\) to return str or bytes, not int' |
3317 | | - ): |
| 3314 | +msg = r'__fspath__\(\) to return str or bytes, not %s' |
| 3315 | +with self.assertRaisesRegex(TypeError, msg % r'int'): |
3318 | 3316 | os.stat(FakePath(2)) |
3319 | | -with self.assertRaisesRegex( |
3320 | | -TypeError, |
3321 | | -'__fspath__\(\) to return str or bytes, not float' |
3322 | | - ): |
| 3317 | +with self.assertRaisesRegex(TypeError, msg % r'float'): |
3323 | 3318 | os.stat(FakePath(2.34)) |
3324 | | -with self.assertRaisesRegex( |
3325 | | -TypeError, |
3326 | | -'__fspath__\(\) to return str or bytes, not object' |
3327 | | - ): |
| 3319 | +with self.assertRaisesRegex(TypeError, msg % r'object'): |
3328 | 3320 | os.stat(FakePath(object())) |
3329 | 3321 | |
3330 | 3322 | |
|