diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2023-10-18 12:58:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 12:58:51 (GMT) |
commit | 3156d193b81f7fefbafa1a5299bc9588a6768956 (patch) | |
tree | 1347c212ffbb880dd707f6e17b7ad6ba3388d127 /Lib/test | |
parent | baefbb21d91db2d950706737a6ebee9b2eff5c2d (diff) | |
download | cpython-3156d193b81f7fefbafa1a5299bc9588a6768956.zip cpython-3156d193b81f7fefbafa1a5299bc9588a6768956.tar.gz cpython-3156d193b81f7fefbafa1a5299bc9588a6768956.tar.bz2 |
gh-100445: Improve error message for unterminated strings with escapes (#100446)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_syntax.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 00c5f62..7ebf9ca 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -2298,8 +2298,14 @@ func( def test_error_string_literal(self): - self._check_error("'blech", "unterminated string literal") - self._check_error('"blech', "unterminated string literal") + self._check_error("'blech", r"unterminated string literal \(.*\)$") + self._check_error('"blech', r"unterminated string literal \(.*\)$") + self._check_error( + r'"blech\"', r"unterminated string literal \(.*\); perhaps you escaped the end quote" + ) + self._check_error( + r'r"blech\"', r"unterminated string literal \(.*\); perhaps you escaped the end quote" + ) self._check_error("'''blech", "unterminated triple-quoted string literal") self._check_error('"""blech', "unterminated triple-quoted string literal") |