summaryrefslogtreecommitdiff
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-12-13 16:46:48 +0000
committerGitHub <noreply@github.com>2020-12-13 16:46:48 +0000
commit43c4fb6c90c013a00cb820cb61e4990cd8ec7f5e (patch)
tree6486bd0491db555ea6e0e18a1583e2a1098d7e1b /Lib/test/test_syntax.py
parentda431f789bd1e6b9790f06f9ce47b3ec6a701e65 (diff)
downloadcpython-git-43c4fb6c90c013a00cb820cb61e4990cd8ec7f5e.tar.gz
bpo-30858: Improve error location for expressions with assignments (GH-23753)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 91ca1db43a..d8255607dc 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -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")