]> granicus.if.org Git - python/commitdiff
Use raw strings for regex to avoid invalid escape sequences. (GH-4741)
authorEric V. Smith <ericvsmith@users.noreply.github.com>
Wed, 6 Dec 2017 19:00:34 +0000 (14:00 -0500)
committerGitHub <noreply@github.com>
Wed, 6 Dec 2017 19:00:34 +0000 (14:00 -0500)
Lib/test/test_dataclasses.py

index caea98a13b06b7efecfdbda0015d59e1a8fb32ab..9d08a2d4c916fe1fee457733b669ca121176eec6 100755 (executable)
@@ -1831,7 +1831,7 @@ class TestCase(unittest.TestCase):
         #  if we're also replacing one that does exist.  Test this
         #  here, because setting attributes on frozen instances is
         #  handled slightly differently from non-frozen ones.
-        with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected "
+        with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected "
                                              "keyword argument 'a'"):
             c1 = replace(c, x=20, a=5)
 
@@ -1842,7 +1842,7 @@ class TestCase(unittest.TestCase):
             y: int
 
         c = C(1, 2)
-        with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected "
+        with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected "
                                     "keyword argument 'z'"):
             c1 = replace(c, z=3)