aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 8cae62459bb..4c001f9c9b0 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -948,6 +948,18 @@ isn't, there should be a syntax error.
...
SyntaxError: 'break' outside loop
+elif can't come after an else.
+
+ >>> if a % 2 == 0:
+ ... pass
+ ... else:
+ ... pass
+ ... elif a % 2 == 1:
+ ... pass
+ Traceback (most recent call last):
+ ...
+ SyntaxError: 'elif' block follows an 'else' block
+
Misuse of the nonlocal and global statement can lead to a few unique syntax errors.
>>> def f():