gh-131649: fix test_string_literals SyntaxWarning (#131650)

This commit is contained in:
Thomas Grainger 2025-03-26 14:01:18 +00:00 committed by GitHub
parent 5abff6960b
commit 2d83891dfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -177,7 +177,7 @@ class TestLiterals(unittest.TestCase):
def test_invalid_escape_locations_with_offset(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', category=SyntaxWarning)
eval("\"'''''''''''''''''''''invalid\ Escape\"")
eval("\"'''''''''''''''''''''invalid\\ Escape\"")
self.assertEqual(len(w), 1)
self.assertEqual(str(w[0].message),
r'"\ " is an invalid escape sequence. Such sequences '
@ -188,7 +188,7 @@ class TestLiterals(unittest.TestCase):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', category=SyntaxWarning)
eval("\"''Incorrect \ logic?\"")
eval("\"''Incorrect \\ logic?\"")
self.assertEqual(len(w), 1)
self.assertEqual(str(w[0].message),
r'"\ " is an invalid escape sequence. Such sequences '