mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
bpo-30858: Improve error location for expressions with assignments (GH-23753)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
da431f789b
commit
43c4fb6c90
5 changed files with 15 additions and 6 deletions
|
@ -802,6 +802,13 @@ class SyntaxTestCase(unittest.TestCase):
|
|||
else:
|
||||
self.fail("compile() did not raise SyntaxError")
|
||||
|
||||
def test_expression_with_assignment(self):
|
||||
self._check_error(
|
||||
"print(end1 + end2 = ' ')",
|
||||
'expression cannot contain assignment, perhaps you meant "=="?',
|
||||
offset=19
|
||||
)
|
||||
|
||||
def test_curly_brace_after_primary_raises_immediately(self):
|
||||
self._check_error("f{", "invalid syntax", mode="single")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue