Fix syntax warnings in tests introduced in bpo-35942. (GH-11934) · python/cpython@a883490

Original file line numberDiff line numberDiff line change

@@ -3311,20 +3311,12 @@ def test_path_t_converter(self):

33113311

fn(fd, *extra_args)

33123312
33133313

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'):

33183316

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'):

33233318

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'):

33283320

os.stat(FakePath(object()))

33293321
33303322