[Python-checkins] bpo-45292: Use raw strings for regex in tests (GH-29545)

tirkarthi webhook-mailer at python.org
Tue Nov 16 06:58:32 EST 2021


https://github.com/python/cpython/commit/8b06d01507fd708468570eaa43a349828784489a
commit: 8b06d01507fd708468570eaa43a349828784489a
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: tirkarthi <tir.karthi at gmail.com>
date: 2021-11-16T17:28:21+05:30
summary:

bpo-45292: Use raw strings for regex in tests (GH-29545)

files:
M Lib/test/test_exception_group.py

diff --git a/Lib/test/test_exception_group.py b/Lib/test/test_exception_group.py
index 5bb6094cde742..62ec1ee248de5 100644
--- a/Lib/test/test_exception_group.py
+++ b/Lib/test/test_exception_group.py
@@ -38,18 +38,18 @@ def test_bad_EG_construction__bad_message(self):
             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]);



More information about the Python-checkins mailing list