]> granicus.if.org Git - python/commitdiff
Fix syntax warnings in tests introduced in bpo-35942. (GH-11934)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 19 Feb 2019 11:52:35 +0000 (13:52 +0200)
committerGitHub <noreply@github.com>
Tue, 19 Feb 2019 11:52:35 +0000 (13:52 +0200)
Lib/test/test_os.py

index d478c64038c2d3ac7c50171683eeee8d5a4333a3..2cfcebcc86488f7bb9ea7b7975e2922213ee8381 100644 (file)
@@ -3358,20 +3358,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()))