[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
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index d5a52ba..c77aafe 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -152,6 +152,14 @@
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