diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2020-05-07 13:44:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 11:44:06 +0100 |
commit | 4638c6429575bd6de26b12b2af5df74d6568b553 (patch) | |
tree | db027fceca158090caf8f194fc577d6631f82daa /Lib/test/test_peg_parser.py | |
parent | 2f37c355ab0e9ec9c1753985d27c41fa0bd719b9 (diff) | |
download | cpython-git-4638c6429575bd6de26b12b2af5df74d6568b553.tar.gz |
bpo-40334: Error message for invalid default args in function call (GH-19973)
When parsing something like `f(g()=2)`, where the name of a default arg
is not a NAME, but an arbitrary expression, a specialised error message
is emitted.
Diffstat (limited to 'Lib/test/test_peg_parser.py')
-rw-r--r-- | Lib/test/test_peg_parser.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_peg_parser.py b/Lib/test/test_peg_parser.py index d6939fdbf6..df2d46d882 100644 --- a/Lib/test/test_peg_parser.py +++ b/Lib/test/test_peg_parser.py @@ -609,6 +609,9 @@ FAIL_SPECIALIZED_MESSAGE_CASES = [ ("lambda *: pass", "named arguments must follow bare *"), ("lambda *,: pass", "named arguments must follow bare *"), ("lambda *, **a: pass", "named arguments must follow bare *"), + ("f(g()=2", "expression cannot contain assignment, perhaps you meant \"==\"?"), + ("f(a, b, *c, d.e=2", "expression cannot contain assignment, perhaps you meant \"==\"?"), + ("f(*a, **b, c=0, d[1]=3)", "expression cannot contain assignment, perhaps you meant \"==\"?"), ] GOOD_BUT_FAIL_TEST_CASES = [ |