Skip to content

Commit 8d01eb4

Browse files
Fix syntax warnings in tests introduced in bpo-35942. (pythonGH-11934)
1 parent 8e79e6e commit 8d01eb4

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Lib/test/test_os.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,20 +3358,12 @@ def test_path_t_converter(self):
33583358
fn(fd, *extra_args)
33593359

33603360
def test_path_t_converter_and_custom_class(self):
3361-
with self.assertRaisesRegex(
3362-
TypeError,
3363-
'__fspath__\(\) to return str or bytes, not int'
3364-
):
3361+
msg = r'__fspath__\(\) to return str or bytes, not %s'
3362+
with self.assertRaisesRegex(TypeError, msg % r'int'):
33653363
os.stat(FakePath(2))
3366-
with self.assertRaisesRegex(
3367-
TypeError,
3368-
'__fspath__\(\) to return str or bytes, not float'
3369-
):
3364+
with self.assertRaisesRegex(TypeError, msg % r'float'):
33703365
os.stat(FakePath(2.34))
3371-
with self.assertRaisesRegex(
3372-
TypeError,
3373-
'__fspath__\(\) to return str or bytes, not object'
3374-
):
3366+
with self.assertRaisesRegex(TypeError, msg % r'object'):
33753367
os.stat(FakePath(object()))
33763368

33773369

0 commit comments

Comments
 (0)