Back to index

python3.2  3.2.2
Public Member Functions
test.test_sys_settrace.JumpTestCase Class Reference

List of all members.

Public Member Functions

def compare_jump_output
def run_test
def test_01_jump_simple_forwards
def test_02_jump_simple_backwards
def test_03_jump_out_of_block_forwards
def test_04_jump_out_of_block_backwards
def test_05_jump_to_codeless_line
def test_06_jump_to_same_line
def test_07_jump_in_nested_finally
def test_08_no_jump_too_far_forwards
def test_09_no_jump_too_far_backwards
def test_10_no_jump_to_except_1
def test_11_no_jump_to_except_2
def test_12_no_jump_to_except_3
def test_13_no_jump_to_except_4
def test_14_no_jump_forwards_into_block
def test_15_no_jump_backwards_into_block
def test_16_no_jump_into_finally_block
def test_17_no_jump_out_of_finally_block
def test_18_no_jump_to_non_integers
def test_19_no_jump_without_trace_function
def test_20_large_function
def test_jump_to_firstlineno

Detailed Description

Definition at line 690 of file test_sys_settrace.py.


Member Function Documentation

def test.test_sys_settrace.JumpTestCase.compare_jump_output (   self,
  expected,
  received 
)

Definition at line 691 of file test_sys_settrace.py.

00691 
00692     def compare_jump_output(self, expected, received):
00693         if received != expected:
00694             self.fail( "Outputs don't match:\n" +
00695                        "Expected: " + repr(expected) + "\n" +
00696                        "Received: " + repr(received))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 697 of file test_sys_settrace.py.

00697 
00698     def run_test(self, func):
00699         tracer = JumpTracer(func)
00700         sys.settrace(tracer.trace)
00701         output = []
00702         func(output)
00703         sys.settrace(None)
00704         self.compare_jump_output(func.output, output)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 705 of file test_sys_settrace.py.

00705 
00706     def test_01_jump_simple_forwards(self):
        self.run_test(jump_simple_forwards)

Here is the call graph for this function:

Definition at line 707 of file test_sys_settrace.py.

00707 
00708     def test_02_jump_simple_backwards(self):
        self.run_test(jump_simple_backwards)

Here is the call graph for this function:

Definition at line 709 of file test_sys_settrace.py.

00709 
00710     def test_03_jump_out_of_block_forwards(self):
        self.run_test(jump_out_of_block_forwards)

Here is the call graph for this function:

Definition at line 711 of file test_sys_settrace.py.

00711 
00712     def test_04_jump_out_of_block_backwards(self):
        self.run_test(jump_out_of_block_backwards)

Here is the call graph for this function:

Definition at line 713 of file test_sys_settrace.py.

00713 
00714     def test_05_jump_to_codeless_line(self):
        self.run_test(jump_to_codeless_line)

Here is the call graph for this function:

Definition at line 715 of file test_sys_settrace.py.

00715 
00716     def test_06_jump_to_same_line(self):
        self.run_test(jump_to_same_line)

Here is the call graph for this function:

Definition at line 717 of file test_sys_settrace.py.

00717 
00718     def test_07_jump_in_nested_finally(self):
        self.run_test(jump_in_nested_finally)

Here is the call graph for this function:

Definition at line 719 of file test_sys_settrace.py.

00719 
00720     def test_08_no_jump_too_far_forwards(self):
        self.run_test(no_jump_too_far_forwards)

Here is the call graph for this function:

Definition at line 721 of file test_sys_settrace.py.

00721 
00722     def test_09_no_jump_too_far_backwards(self):
        self.run_test(no_jump_too_far_backwards)

Here is the call graph for this function:

Definition at line 723 of file test_sys_settrace.py.

00723 
00724     def test_10_no_jump_to_except_1(self):
        self.run_test(no_jump_to_except_1)

Here is the call graph for this function:

Definition at line 725 of file test_sys_settrace.py.

00725 
00726     def test_11_no_jump_to_except_2(self):
        self.run_test(no_jump_to_except_2)

Here is the call graph for this function:

Definition at line 727 of file test_sys_settrace.py.

00727 
00728     def test_12_no_jump_to_except_3(self):
        self.run_test(no_jump_to_except_3)

Here is the call graph for this function:

Definition at line 729 of file test_sys_settrace.py.

00729 
00730     def test_13_no_jump_to_except_4(self):
        self.run_test(no_jump_to_except_4)

Here is the call graph for this function:

Definition at line 731 of file test_sys_settrace.py.

00731 
00732     def test_14_no_jump_forwards_into_block(self):
        self.run_test(no_jump_forwards_into_block)

Here is the call graph for this function:

Definition at line 733 of file test_sys_settrace.py.

00733 
00734     def test_15_no_jump_backwards_into_block(self):
        self.run_test(no_jump_backwards_into_block)

Here is the call graph for this function:

Definition at line 735 of file test_sys_settrace.py.

00735 
00736     def test_16_no_jump_into_finally_block(self):
        self.run_test(no_jump_into_finally_block)

Here is the call graph for this function:

Definition at line 737 of file test_sys_settrace.py.

00737 
00738     def test_17_no_jump_out_of_finally_block(self):
        self.run_test(no_jump_out_of_finally_block)

Here is the call graph for this function:

Definition at line 739 of file test_sys_settrace.py.

00739 
00740     def test_18_no_jump_to_non_integers(self):
        self.run_test(no_jump_to_non_integers)

Here is the call graph for this function:

Definition at line 741 of file test_sys_settrace.py.

Here is the call graph for this function:

Definition at line 744 of file test_sys_settrace.py.

00744 
00745     def test_20_large_function(self):
00746         d = {}
00747         exec("""def f(output):        # line 0
00748             x = 0                     # line 1
00749             y = 1                     # line 2
00750             '''                       # line 3
00751             %s                        # lines 4-1004
00752             '''                       # line 1005
00753             x += 1                    # line 1006
00754             output.append(x)          # line 1007
00755             return""" % ('\n' * 1000,), d)
00756         f = d['f']
00757 
00758         f.jump = (2, 1007)
00759         f.output = [0]
00760         self.run_test(f)

Here is the call graph for this function:

Definition at line 761 of file test_sys_settrace.py.

00761 
00762     def test_jump_to_firstlineno(self):
00763         # This tests that PDB can jump back to the first line in a
00764         # file.  See issue #1689458.  It can only be triggered in a
00765         # function call if the function is defined on a single line.
00766         code = compile("""
00767 # Comments don't count.
00768 output.append(2)  # firstlineno is here.
00769 output.append(3)
00770 output.append(4)
00771 """, "<fake module>", "exec")
00772         class fake_function:
00773             __code__ = code
00774             jump = (2, 0)
00775         tracer = JumpTracer(fake_function)
00776         sys.settrace(tracer.trace)
00777         namespace = {"output": []}
00778         exec(code, namespace)
00779         sys.settrace(None)
00780         self.compare_jump_output([2, 3, 2, 3, 4], namespace["output"])
00781 

Here is the call graph for this function:


The documentation for this class was generated from the following file: