diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2025-04-01 20:04:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 19:04:56 +0000 |
commit | c2ac662f284b7c3f0701173f2467bf1e18aad2e2 (patch) | |
tree | 2ff5b9d81ebb22945875a183ac807fd77b6e82f7 /Lib/test/test_syntax.py | |
parent | 053c285f6b41f92fbdd1d4ff0c959cceefacd7cd (diff) | |
download | cpython-c2ac662f284b7c3f0701173f2467bf1e18aad2e2.tar.gz cpython-c2ac662f284b7c3f0701173f2467bf1e18aad2e2.zip |
gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses (#131833)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index d2950cf48ab..2c87b145254 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -1667,28 +1667,14 @@ Make sure that the old "raise X, Y[, Z]" form is gone: SyntaxError: invalid syntax Check that an multiple exception types with missing parentheses -raise a custom exception - - >>> try: - ... pass - ... except A, B: - ... pass - Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized - - >>> try: - ... pass - ... except A, B, C: - ... pass - Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized +raise a custom exception only when using 'as' >>> try: ... pass ... except A, B, C as blech: ... pass Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized + SyntaxError: multiple exception types must be parenthesized when using 'as' >>> try: ... pass @@ -1697,29 +1683,15 @@ raise a custom exception ... finally: ... pass Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized + SyntaxError: multiple exception types must be parenthesized when using 'as' >>> try: ... pass - ... except* A, B: - ... pass - Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized - - >>> try: - ... pass - ... except* A, B, C: - ... pass - Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized - - >>> try: - ... pass ... except* A, B, C as blech: ... pass Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized + SyntaxError: multiple exception types must be parenthesized when using 'as' >>> try: ... pass @@ -1728,7 +1700,7 @@ raise a custom exception ... finally: ... pass Traceback (most recent call last): - SyntaxError: multiple exception types must be parenthesized + SyntaxError: multiple exception types must be parenthesized when using 'as' Custom exception for 'except*' without an exception type |