]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix syntax warnings in tests introduced in bpo-35942. (GH-11934)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 19 Feb 2019 12:16:36 +0000 (04:16 -0800)
committerGitHub <noreply@github.com>
Tue, 19 Feb 2019 12:16:36 +0000 (04:16 -0800)
(cherry picked from commit 8d01eb49fc7ff914feeb2e2090d1d6ef15c932ab)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_os.py

index 06144713633b2c9feffadca0a4a04904b11147ae..bb31e053bae19bf1642a2f9a726279b9b6dbc752 100644 (file)
@@ -3311,20 +3311,12 @@ class PathTConverterTests(unittest.TestCase):
                         fn(fd, *extra_args)
 
     def test_path_t_converter_and_custom_class(self):
-        with self.assertRaisesRegex(
-                TypeError,
-                '__fspath__\(\) to return str or bytes, not int'
-            ):
+        msg = r'__fspath__\(\) to return str or bytes, not %s'
+        with self.assertRaisesRegex(TypeError, msg % r'int'):
             os.stat(FakePath(2))
-        with self.assertRaisesRegex(
-                TypeError,
-                '__fspath__\(\) to return str or bytes, not float'
-            ):
+        with self.assertRaisesRegex(TypeError, msg % r'float'):
             os.stat(FakePath(2.34))
-        with self.assertRaisesRegex(
-                TypeError,
-                '__fspath__\(\) to return str or bytes, not object'
-            ):
+        with self.assertRaisesRegex(TypeError, msg % r'object'):
             os.stat(FakePath(object()))