aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-08-05 18:28:57 +0100
committerGitHub <noreply@github.com>2021-08-05 18:28:57 +0100
commitf5cbea6b1b5fc39cca377c6cc93f222916015fc4 (patch)
treea57f1c3399129af299de14b8952bb77abcb8ba30 /Lib/test/test_syntax.py
parent3d315c311676888201f4a3576e4ee3698684a3a2 (diff)
downloadcpython-f5cbea6b1b5fc39cca377c6cc93f222916015fc4.tar.gz
cpython-f5cbea6b1b5fc39cca377c6cc93f222916015fc4.zip
bpo-44838: Refine the custom syntax errors for invalid 'if' expressions (GH-27615)
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 d5a52ba628a..c77aafeb363 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