mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Use raw strings for regex to avoid invalid escape sequences. (GH-4741)
This commit is contained in:
parent
9d25bd11ca
commit
24e77f9265
1 changed files with 2 additions and 2 deletions
|
@ -1831,7 +1831,7 @@ class TestCase(unittest.TestCase):
|
||||||
# if we're also replacing one that does exist. Test this
|
# if we're also replacing one that does exist. Test this
|
||||||
# here, because setting attributes on frozen instances is
|
# here, because setting attributes on frozen instances is
|
||||||
# handled slightly differently from non-frozen ones.
|
# 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'"):
|
"keyword argument 'a'"):
|
||||||
c1 = replace(c, x=20, a=5)
|
c1 = replace(c, x=20, a=5)
|
||||||
|
|
||||||
|
@ -1842,7 +1842,7 @@ class TestCase(unittest.TestCase):
|
||||||
y: int
|
y: int
|
||||||
|
|
||||||
c = C(1, 2)
|
c = C(1, 2)
|
||||||
with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected "
|
with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected "
|
||||||
"keyword argument 'z'"):
|
"keyword argument 'z'"):
|
||||||
c1 = replace(c, z=3)
|
c1 = replace(c, z=3)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue