mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-43797: Improve syntax error for invalid comparisons (#25317)
* bpo-43797: Improve syntax error for invalid comparisons * Update Lib/test/test_fstring.py Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> * Apply review comments * can't -> cannot Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
This commit is contained in:
parent
2459b92a4d
commit
b86ed8e3bb
12 changed files with 1375 additions and 779 deletions
|
@ -990,7 +990,7 @@ x = (
|
|||
])
|
||||
|
||||
def test_assignment(self):
|
||||
self.assertAllRaise(SyntaxError, 'invalid syntax',
|
||||
self.assertAllRaise(SyntaxError, r'invalid syntax',
|
||||
["f'' = 3",
|
||||
"f'{0}' = x",
|
||||
"f'{x}' = x",
|
||||
|
@ -1276,11 +1276,11 @@ x = (
|
|||
f'{1:_,}'
|
||||
|
||||
def test_syntax_error_for_starred_expressions(self):
|
||||
error_msg = re.escape("can't use starred expression here")
|
||||
error_msg = re.escape("cannot use starred expression here")
|
||||
with self.assertRaisesRegex(SyntaxError, error_msg):
|
||||
compile("f'{*a}'", "?", "exec")
|
||||
|
||||
error_msg = re.escape("can't use double starred expression here")
|
||||
error_msg = re.escape("cannot use double starred expression here")
|
||||
with self.assertRaisesRegex(SyntaxError, error_msg):
|
||||
compile("f'{**a}'", "?", "exec")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue