mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-100445: Improve error message for unterminated strings with escapes (#100446)
This commit is contained in:
parent
baefbb21d9
commit
3156d193b8
3 changed files with 25 additions and 4 deletions
|
@ -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")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue