aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
authorwookie184 <wookie1840@gmail.com>2022-06-26 19:42:47 +0100
committerGitHub <noreply@github.com>2022-06-26 19:42:47 +0100
commit8c237a7a71d52f996f58dc58f6b6ce558d209494 (patch)
treed74691207859aa85f98e6580d8db2417ec1e7e05 /Lib/test
parentaedb5194d590692918a8a070cbde2727fe178f49 (diff)
downloadcpython-8c237a7a71d52f996f58dc58f6b6ce558d209494.tar.gz
cpython-8c237a7a71d52f996f58dc58f6b6ce558d209494.zip
gh-94192: Fix error for dictionary literals with invalid expression as value. (#94304)
* Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_syntax.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index a9193b0b30c..b22a96b2029 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1265,12 +1265,22 @@ Incomplete dictionary literals
Traceback (most recent call last):
SyntaxError: expression expected after dictionary key and ':'
- # Ensure that the error is not raise for syntax errors that happen after sets
+ # Ensure that the error is not raised for syntax errors that happen after sets
>>> {1} $
Traceback (most recent call last):
SyntaxError: invalid syntax
+ # Ensure that the error is not raised for invalid expressions
+
+ >>> {1: 2, 3: foo(,), 4: 5}
+ Traceback (most recent call last):
+ SyntaxError: invalid syntax
+
+ >>> {1: $, 2: 3}
+ Traceback (most recent call last):
+ SyntaxError: invalid syntax
+
Specialized indentation errors:
>>> while condition: