]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45292: Use raw strings for regex in tests (GH-29545)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Tue, 16 Nov 2021 11:58:21 +0000 (11:58 +0000)
committerGitHub <noreply@github.com>
Tue, 16 Nov 2021 11:58:21 +0000 (17:28 +0530)
Lib/test/test_exception_group.py

index 5bb6094cde742cc746e0e42f93e5879622c8f771..62ec1ee248de59ee10292f1cecffc4ac9122f2ae 100644 (file)
@@ -38,18 +38,18 @@ class BadConstructorArgs(unittest.TestCase):
             ExceptionGroup(None, [ValueError(12)])
 
     def test_bad_EG_construction__bad_excs_sequence(self):
-        MSG = 'second argument \(exceptions\) must be a sequence'
+        MSG = r'second argument \(exceptions\) must be a sequence'
         with self.assertRaisesRegex(TypeError, MSG):
             ExceptionGroup('errors not sequence', {ValueError(42)})
         with self.assertRaisesRegex(TypeError, MSG):
             ExceptionGroup("eg", None)
 
-        MSG = 'second argument \(exceptions\) must be a non-empty sequence'
+        MSG = r'second argument \(exceptions\) must be a non-empty sequence'
         with self.assertRaisesRegex(ValueError, MSG):
             ExceptionGroup("eg", [])
 
     def test_bad_EG_construction__nested_non_exceptions(self):
-        MSG = ('Item [0-9]+ of second argument \(exceptions\)'
+        MSG = (r'Item [0-9]+ of second argument \(exceptions\)'
               ' is not an exception')
         with self.assertRaisesRegex(ValueError, MSG):
             ExceptionGroup('expect instance, not type', [OSError]);