summaryrefslogtreecommitdiff
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-08-05 19:00:19 +0100
committerGitHub <noreply@github.com>2021-08-05 11:00:19 -0700
commitb1bd16c2528295b8b28395827f6b589dccea0624 (patch)
tree8198211ed8809166651cb01ce705dfef9c8d3f9d /Lib/test/test_syntax.py
parent536e35ae6a2555a01f4b51a68ad71dbf7923536d (diff)
downloadcpython-git-b1bd16c2528295b8b28395827f6b589dccea0624.tar.gz
[3.10] bpo-44838: Refine the custom syntax errors for invalid 'if' expressions (GH-27615). (GH-27616)
… (cherry picked from commit f5cbea6b1b5fc39cca377c6cc93f222916015fc4) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Automerge-Triggered-By: GH:lysnikolaou
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index d5a52ba628..c77aafeb36 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -152,6 +152,14 @@ SyntaxError: expected 'else' after 'if' expression
Traceback (most recent call last):
SyntaxError: expected 'else' after 'if' expression
+>>> if True:
+... print("Hello"
+...
+... if 2:
+... print(123))
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
>>> True = True = 3
Traceback (most recent call last):
SyntaxError: cannot assign to True