@@ -1879,7 +1879,7 @@ def test_jump_out_of_block_backwards(output):
18791879 output .append (6 )
18801880 output .append (7 )
18811881
1882- @async_jump_test (4 , 5 , [3 ], ( ValueError , 'into' ) )
1882+ @async_jump_test (4 , 5 , [3 , 5 ] )
18831883 async def test_jump_out_of_async_for_block_forwards (output ):
18841884 for i in [1 ]:
18851885 async for i in asynciter ([1 , 2 ]):
@@ -1921,7 +1921,7 @@ def test_jump_in_nested_finally(output):
19211921 output .append (8 )
19221922 output .append (9 )
19231923
1924- @jump_test (6 , 7 , [2 ], (ValueError , 'within ' ))
1924+ @jump_test (6 , 7 , [2 , 7 ], (ZeroDivisionError , '' ))
19251925 def test_jump_in_nested_finally_2 (output ):
19261926 try :
19271927 output .append (2 )
@@ -1932,7 +1932,7 @@ def test_jump_in_nested_finally_2(output):
19321932 output .append (7 )
19331933 output .append (8 )
19341934
1935- @jump_test (6 , 11 , [2 ], (ValueError , 'within ' ))
1935+ @jump_test (6 , 11 , [2 , 11 ], (ZeroDivisionError , '' ))
19361936 def test_jump_in_nested_finally_3 (output ):
19371937 try :
19381938 output .append (2 )
@@ -2043,8 +2043,8 @@ def test_jump_backwards_out_of_try_except_block(output):
20432043 output .append (5 )
20442044 raise
20452045
2046- @jump_test (5 , 7 , [4 ], ( ValueError , 'within' ) )
2047- def test_no_jump_between_except_blocks (output ):
2046+ @jump_test (5 , 7 , [4 , 7 , 8 ] )
2047+ def test_jump_between_except_blocks (output ):
20482048 try :
20492049 1 / 0
20502050 except ZeroDivisionError :
@@ -2054,8 +2054,19 @@ def test_no_jump_between_except_blocks(output):
20542054 output .append (7 )
20552055 output .append (8 )
20562056
2057- @jump_test (5 , 6 , [4 ], (ValueError , 'within' ))
2058- def test_no_jump_within_except_block (output ):
2057+ @jump_test (5 , 7 , [4 , 7 , 8 ])
2058+ def test_jump_from_except_to_finally (output ):
2059+ try :
2060+ 1 / 0
2061+ except ZeroDivisionError :
2062+ output .append (4 )
2063+ output .append (5 )
2064+ finally :
2065+ output .append (7 )
2066+ output .append (8 )
2067+
2068+ @jump_test (5 , 6 , [4 , 6 , 7 ])
2069+ def test_jump_within_except_block (output ):
20592070 try :
20602071 1 / 0
20612072 except :
@@ -2290,7 +2301,7 @@ def test_no_jump_backwards_into_for_block(output):
22902301 output .append (2 )
22912302 output .append (3 )
22922303
2293- @async_jump_test (3 , 2 , [2 , 2 ], (ValueError , 'within' ))
2304+ @async_jump_test (3 , 2 , [2 , 2 ], (ValueError , "can't jump into the body of a for loop" ))
22942305 async def test_no_jump_backwards_into_async_for_block (output ):
22952306 async for i in asynciter ([1 , 2 ]):
22962307 output .append (2 )
@@ -2355,8 +2366,8 @@ def test_jump_backwards_into_try_except_block(output):
23552366 output .append (6 )
23562367
23572368 # 'except' with a variable creates an implicit finally block
2358- @jump_test (5 , 7 , [4 ], ( ValueError , 'within' ) )
2359- def test_no_jump_between_except_blocks_2 (output ):
2369+ @jump_test (5 , 7 , [4 , 7 , 8 ] )
2370+ def test_jump_between_except_blocks_2 (output ):
23602371 try :
23612372 1 / 0
23622373 except ZeroDivisionError :
@@ -2392,23 +2403,23 @@ def test_jump_out_of_finally_block(output):
23922403 finally :
23932404 output .append (5 )
23942405
2395- @jump_test (1 , 5 , [], (ValueError , "into an exception" ))
2406+ @jump_test (1 , 5 , [], (ValueError , "can't jump into an 'except' block as there's no exception" ))
23962407 def test_no_jump_into_bare_except_block (output ):
23972408 output .append (1 )
23982409 try :
23992410 output .append (3 )
24002411 except :
24012412 output .append (5 )
24022413
2403- @jump_test (1 , 5 , [], (ValueError , "into an exception" ))
2414+ @jump_test (1 , 5 , [], (ValueError , "can't jump into an 'except' block as there's no exception" ))
24042415 def test_no_jump_into_qualified_except_block (output ):
24052416 output .append (1 )
24062417 try :
24072418 output .append (3 )
24082419 except Exception :
24092420 output .append (5 )
24102421
2411- @jump_test (3 , 6 , [2 , 5 , 6 ], (ValueError , "into an exception" ))
2422+ @jump_test (3 , 6 , [2 , 5 , 6 ], (ValueError , "can't jump into an 'except' block as there's no exception" ))
24122423 def test_no_jump_into_bare_except_block_from_try_block (output ):
24132424 try :
24142425 output .append (2 )
@@ -2419,7 +2430,7 @@ def test_no_jump_into_bare_except_block_from_try_block(output):
24192430 raise
24202431 output .append (8 )
24212432
2422- @jump_test (3 , 6 , [2 ], (ValueError , "into an exception" ))
2433+ @jump_test (3 , 6 , [2 ], (ValueError , "can't jump into an 'except' block as there's no exception" ))
24232434 def test_no_jump_into_qualified_except_block_from_try_block (output ):
24242435 try :
24252436 output .append (2 )
@@ -2430,8 +2441,8 @@ def test_no_jump_into_qualified_except_block_from_try_block(output):
24302441 raise
24312442 output .append (8 )
24322443
2433- @jump_test (7 , 1 , [1 , 3 , 6 ], ( ValueError , "within" ) )
2434- def test_no_jump_out_of_bare_except_block (output ):
2444+ @jump_test (7 , 1 , [1 , 3 , 6 , 1 , 3 , 6 , 7 ] )
2445+ def test_jump_out_of_bare_except_block (output ):
24352446 output .append (1 )
24362447 try :
24372448 output .append (3 )
@@ -2440,8 +2451,8 @@ def test_no_jump_out_of_bare_except_block(output):
24402451 output .append (6 )
24412452 output .append (7 )
24422453
2443- @jump_test (7 , 1 , [1 , 3 , 6 ], ( ValueError , "within" ) )
2444- def test_no_jump_out_of_qualified_except_block (output ):
2454+ @jump_test (7 , 1 , [1 , 3 , 6 , 1 , 3 , 6 , 7 ] )
2455+ def test_jump_out_of_qualified_except_block (output ):
24452456 output .append (1 )
24462457 try :
24472458 output .append (3 )
0 commit comments