Back to index

python3.2  3.2.2
Classes | Functions
test.test_trace Namespace Reference

Classes

class  TracedClass
class  TestLineCounts
class  TestRunExecCounts
class  TestFuncs
class  TestCallers
class  TestCoverage
class  Test_Ignore

Functions

def fix_ext_py
def my_file_and_modname
def get_firstlineno
def traced_func_linear
def traced_func_loop
def traced_func_importing
def traced_func_simple_caller
def traced_func_importing_caller
def traced_func_generator
def traced_func_calling_generator
def traced_doubler
def traced_caller_list_comprehension
def test_main

Function Documentation

def test.test_trace.fix_ext_py (   filename)
Given a .pyc/.pyo filename converts it to the appropriate .py

Definition at line 15 of file test_trace.py.

00015 
00016 def fix_ext_py(filename):
00017     """Given a .pyc/.pyo filename converts it to the appropriate .py"""
00018     if filename.endswith(('.pyc', '.pyo')):
00019         filename = filename[:-1]
00020     return filename

Here is the caller graph for this function:

Definition at line 26 of file test_trace.py.

00026 
00027 def get_firstlineno(func):
00028     return func.__code__.co_firstlineno
00029 
00030 #-------------------- Target functions for tracing ---------------------------#
00031 #
00032 # The relative line numbers of lines in these functions matter for verifying
00033 # tracing. Please modify the appropriate tests if you change one of the
00034 # functions. Absolute line numbers don't matter.
00035 #

Here is the caller graph for this function:

The .py file and module name of this file (__file__)

Definition at line 21 of file test_trace.py.

00021 
00022 def my_file_and_modname():
00023     """The .py file and module name of this file (__file__)"""
00024     modname = os.path.splitext(os.path.basename(__file__))[0]
00025     return fix_ext_py(__file__), modname

Here is the call graph for this function:

Definition at line 353 of file test_trace.py.

00353 
00354 def test_main():
00355     run_unittest(__name__)
00356 

Here is the call graph for this function:

Definition at line 73 of file test_trace.py.

00073 
00074 def traced_caller_list_comprehension():
00075     k = 10
00076     mylist = [traced_doubler(i) for i in range(k)]
00077     return mylist
00078 

Here is the call graph for this function:

Definition at line 70 of file test_trace.py.

00070 
00071 def traced_doubler(num):
00072     return num * 2

Here is the caller graph for this function:

Definition at line 65 of file test_trace.py.

00065 
00066 def traced_func_calling_generator():
00067     k = 0
00068     for i in traced_func_generator(10):
00069         k += i

Here is the call graph for this function:

Definition at line 60 of file test_trace.py.

00060 
00061 def traced_func_generator(num):
00062     c = 5       # executed once
00063     for i in range(num):
00064         yield i + c

Here is the caller graph for this function:

Definition at line 48 of file test_trace.py.

00048 
00049 def traced_func_importing(x, y):
00050     return x + y + testmod.func(1)

Here is the caller graph for this function:

Definition at line 55 of file test_trace.py.

00055 
00056 def traced_func_importing_caller(x):
00057     k = traced_func_simple_caller(x)
00058     k += traced_func_importing(k, x)
00059     return k

Here is the call graph for this function:

def test.test_trace.traced_func_linear (   x,
  y 
)

Definition at line 36 of file test_trace.py.

00036 
00037 def traced_func_linear(x, y):
00038     a = x
00039     b = y
00040     c = a + b
00041     return c

Here is the caller graph for this function:

def test.test_trace.traced_func_loop (   x,
  y 
)

Definition at line 42 of file test_trace.py.

00042 
00043 def traced_func_loop(x, y):
00044     c = x
00045     for i in range(5):
00046         c += y
00047     return c

Definition at line 51 of file test_trace.py.

00051 
00052 def traced_func_simple_caller(x):
00053     c = traced_func_linear(x, x)
00054     return c + x

Here is the call graph for this function:

Here is the caller graph for this function: