[Python-checkins] Fix syntax warnings in tests introduced in bpo-35942. (GH-11934)

Miss Islington (bot) webhook-mailer at python.org
Tue Feb 19 07:16:42 EST 2019


https://github.com/python/cpython/commit/a8834905df853510f38d4e2d628bed8229fd7482
commit: a8834905df853510f38d4e2d628bed8229fd7482
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-02-19T04:16:36-08:00
summary:

Fix syntax warnings in tests introduced in bpo-35942. (GH-11934)

(cherry picked from commit 8d01eb49fc7ff914feeb2e2090d1d6ef15c932ab)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
M Lib/test/test_os.py

diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 06144713633b..bb31e053bae1 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -3311,20 +3311,12 @@ def test_path_t_converter(self):
                         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()))
 
 



More information about the Python-checkins mailing list