(self)
| 2809 | self.run_test(f, 2, 1007, [0], warning=(RuntimeWarning, self.unbound_locals)) |
| 2810 | |
| 2811 | def test_jump_to_firstlineno(self): |
| 2812 | # This tests that PDB can jump back to the first line in a |
| 2813 | # file. See issue #1689458. It can only be triggered in a |
| 2814 | # function call if the function is defined on a single line. |
| 2815 | code = compile(""" |
| 2816 | # Comments don't count. |
| 2817 | output.append(2) # firstlineno is here. |
| 2818 | output.append(3) |
| 2819 | output.append(4) |
| 2820 | """, "<fake module>", "exec") |
| 2821 | class fake_function: |
| 2822 | __code__ = code |
| 2823 | tracer = JumpTracer(fake_function, 4, 1) |
| 2824 | sys.settrace(tracer.trace) |
| 2825 | namespace = {"output": []} |
| 2826 | exec(code, namespace) |
| 2827 | sys.settrace(None) |
| 2828 | self.compare_jump_output([2, 3, 2, 3, 4], namespace["output"]) |
| 2829 | |
| 2830 | @jump_test(2, 3, [1], event='call', error=(ValueError, "can't jump from" |
| 2831 | " the 'call' trace event of a new frame")) |
nothing calls this directly
no test coverage detected