Skip to content

Commit 24e77f9

Browse files
authored
Use raw strings for regex to avoid invalid escape sequences. (GH-4741)
1 parent 9d25bd1 commit 24e77f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ class C:
18311831
# if we're also replacing one that does exist. Test this
18321832
# here, because setting attributes on frozen instances is
18331833
# handled slightly differently from non-frozen ones.
1834-
with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected "
1834+
with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected "
18351835
"keyword argument 'a'"):
18361836
c1 = replace(c, x=20, a=5)
18371837

@@ -1842,7 +1842,7 @@ class C:
18421842
y: int
18431843

18441844
c = C(1, 2)
1845-
with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected "
1845+
with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected "
18461846
"keyword argument 'z'"):
18471847
c1 = replace(c, z=3)
18481848

0 commit comments

Comments
 (0)