diff options
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 70dd22c62a..47df0579f1 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -835,6 +835,39 @@ Make sure that the old "raise X, Y[, Z]" form is gone: ... SyntaxError: invalid syntax +Check that an exception group with missing parentheses +raise a custom exception + + >>> try: + ... pass + ... except A, B: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C as blech: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C as blech: + ... pass + ... finally: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + >>> f(a=23, a=234) Traceback (most recent call last): |