diff options
author | Mark Shannon <mark@hotpy.org> | 2020-04-29 15:49:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 15:49:45 (GMT) |
commit | 57697245e1deafdedf68e5f21ad8890be591efc0 (patch) | |
tree | 830c22529907fab4aa8f320a6165b4ee6df5f507 /Lib/test/test_sys_settrace.py | |
parent | ec9bea4a3766bd815148a27f61eb24e7dd459ac7 (diff) | |
download | cpython-57697245e1deafdedf68e5f21ad8890be591efc0.zip cpython-57697245e1deafdedf68e5f21ad8890be591efc0.tar.gz cpython-57697245e1deafdedf68e5f21ad8890be591efc0.tar.bz2 |
bpo-40228: More robust frame.setlineno. (GH-19437)
More robust frame.setlineno. Makes no assumptions about source->bytecode translation.
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index bead57c..482e918 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -948,8 +948,8 @@ class JumpTestCase(unittest.TestCase): output.append(11) output.append(12) - @jump_test(5, 11, [2, 4, 12]) - def test_jump_over_return_try_finally_in_finally_block(output): + @jump_test(5, 11, [2, 4], (ValueError, 'unreachable')) + def test_no_jump_over_return_try_finally_in_finally_block(output): try: output.append(2) finally: @@ -963,8 +963,8 @@ class JumpTestCase(unittest.TestCase): pass output.append(12) - @jump_test(3, 4, [1, 4]) - def test_jump_infinite_while_loop(output): + @jump_test(3, 4, [1], (ValueError, 'unreachable')) + def test_no_jump_infinite_while_loop(output): output.append(1) while True: output.append(3) @@ -1357,16 +1357,16 @@ class JumpTestCase(unittest.TestCase): output.append(7) output.append(8) - @jump_test(1, 5, [], (ValueError, "into a 'finally'")) - def test_no_jump_into_finally_block(output): + @jump_test(1, 5, [5]) + def test_jump_into_finally_block(output): output.append(1) try: output.append(3) finally: output.append(5) - @jump_test(3, 6, [2, 5, 6], (ValueError, "into a 'finally'")) - def test_no_jump_into_finally_block_from_try_block(output): + @jump_test(3, 6, [2, 6, 7]) + def test_jump_into_finally_block_from_try_block(output): try: output.append(2) output.append(3) @@ -1375,8 +1375,8 @@ class JumpTestCase(unittest.TestCase): output.append(6) output.append(7) - @jump_test(5, 1, [1, 3], (ValueError, "out of a 'finally'")) - def test_no_jump_out_of_finally_block(output): + @jump_test(5, 1, [1, 3, 1, 3, 5]) + def test_jump_out_of_finally_block(output): output.append(1) try: output.append(3) @@ -1441,23 +1441,23 @@ class JumpTestCase(unittest.TestCase): output.append(6) output.append(7) - @jump_test(3, 5, [1, 2, -2], (ValueError, 'into')) - def test_no_jump_between_with_blocks(output): + @jump_test(3, 5, [1, 2, 5, -2]) + def test_jump_between_with_blocks(output): output.append(1) with tracecontext(output, 2): output.append(3) with tracecontext(output, 4): output.append(5) - @async_jump_test(3, 5, [1, 2, -2], (ValueError, 'into')) - async def test_no_jump_between_async_with_blocks(output): + @async_jump_test(3, 5, [1, 2, 5, -2]) + async def test_jump_between_async_with_blocks(output): output.append(1) async with asynctracecontext(output, 2): output.append(3) async with asynctracecontext(output, 4): output.append(5) - @jump_test(5, 7, [2, 4], (ValueError, 'finally')) + @jump_test(5, 7, [2, 4], (ValueError, "unreachable")) def test_no_jump_over_return_out_of_finally_block(output): try: output.append(2) @@ -1551,9 +1551,8 @@ output.append(4) output.append(1) 1 / 0 - @jump_test(3, 2, [2], event='return', error=(ValueError, - "can't jump from a 'yield' statement")) - def test_no_jump_from_yield(output): + @jump_test(3, 2, [2, 5], event='return') + def test_jump_from_yield(output): def gen(): output.append(2) yield 3 |