summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-26 19:07:02 (GMT)
committerGitHub <noreply@github.com>2022-06-26 19:07:02 (GMT)
commit442dd8ffa557018d76adea3058e49cfe8849f851 (patch)
treeb954dd40f018ede23f91f91b4299b79c94758da7 /Lib/test/test_syntax.py
parent1b27ec5ac62606b6b5da34dfb794d5975949f864 (diff)
downloadcpython-442dd8ffa557018d76adea3058e49cfe8849f851.zip
cpython-442dd8ffa557018d76adea3058e49cfe8849f851.tar.gz
cpython-442dd8ffa557018d76adea3058e49cfe8849f851.tar.bz2
gh-94192: Fix error for dictionary literals with invalid expression as value. (GH-94304)
* Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace (cherry picked from commit 8c237a7a71d52f996f58dc58f6b6ce558d209494) Co-authored-by: wookie184 <wookie1840@gmail.com>
Diffstat (limited to 'Lib/test/test_syntax.py')
-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 a9193b0..b22a96b 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: