https://github.com/python/cpython/commit/2d83891dfd51f595de68b0336b3bfc876f7b2507
commit: 2d83891dfd51f595de68b0336b3bfc876f7b2507
branch: main
author: Thomas Grainger <[email protected]>
committer: vstinner <[email protected]>
date: 2025-03-26T15:01:18+01:00
summary:
gh-131649: fix test_string_literals SyntaxWarning (#131650)
files:
M Lib/test/test_string_literals.py
diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py
index 9d57233eb0882a..1800b17e1df3d7 100644
--- a/Lib/test/test_string_literals.py
+++ b/Lib/test/test_string_literals.py
@@ -177,7 +177,7 @@ def test_eval_str_invalid_octal_escape(self):
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 @@ def test_invalid_escape_locations_with_offset(self):
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 '
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]