diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-13 16:51:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 16:51:21 (GMT) |
commit | 30ed93bfec5dfa7ee05982e2df8fd810f3f49305 (patch) | |
tree | 2ba7d8eaba2304ec562e5bb877f7a6e0975954fa /Lib | |
parent | fd79af7ae2574aaaa829e40ed780e17ef1f9be84 (diff) | |
download | cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.zip cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.tar.gz cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.tar.bz2 |
bpo-43797: Handle correctly invalid assignments inside function calls and generators (GH-25390)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_genexps.py | 2 | ||||
-rw-r--r-- | Lib/test/test_syntax.py | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index 70fe2bb..5c1a209 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -103,7 +103,7 @@ Verify that parenthesis are required when used as a keyword argument value >>> dict(a = i for i in range(10)) Traceback (most recent call last): ... - SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? + SyntaxError: invalid syntax Verify that parenthesis are required when used as a keyword argument value diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 0e6942f..bd6a4d3 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -868,6 +868,18 @@ Ensure that early = are not matched by the parser as invalid comparisons Traceback (most recent call last): SyntaxError: invalid syntax + >>> dict(x=34); x $ y + Traceback (most recent call last): + SyntaxError: invalid syntax + + >>> dict(x=34, (x for x in range 10), 1); x $ y + Traceback (most recent call last): + SyntaxError: invalid syntax + + >>> dict(x=34, x=1, y=2); x $ y + Traceback (most recent call last): + SyntaxError: invalid syntax + Make sure that the old "raise X, Y[, Z]" form is gone: >>> raise X, Y Traceback (most recent call last): @@ -1013,7 +1025,7 @@ class SyntaxTestCase(unittest.TestCase): def test_expression_with_assignment(self): self._check_error( "print(end1 + end2 = ' ')", - "cannot assign to expression here. Maybe you meant '==' instead of '='?", + 'expression cannot contain assignment, perhaps you meant "=="?', offset=19 ) |