Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_inspect.TestInterpreterStack Class Reference
Inheritance diagram for test.test_inspect.TestInterpreterStack:
Inheritance graph
[legend]
Collaboration diagram for test.test_inspect.TestInterpreterStack:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def test_abuse_done
def test_stack
def test_trace
def test_frame
def test_previous_frame
def istest

Static Public Attributes

tuple predicates

Detailed Description

Definition at line 150 of file test_inspect.py.


Constructor & Destructor Documentation

def test.test_inspect.TestInterpreterStack.__init__ (   self,
  args,
  kwargs 
)

Definition at line 151 of file test_inspect.py.

00151 
00152     def __init__(self, *args, **kwargs):
00153         unittest.TestCase.__init__(self, *args, **kwargs)
00154 
00155         git.abuse(7, 8, 9)

Here is the caller graph for this function:


Member Function Documentation

def test.test_inspect.IsTestBase.istest (   self,
  predicate,
  exp 
) [inherited]

Definition at line 57 of file test_inspect.py.

00057 
00058     def istest(self, predicate, exp):
00059         obj = eval(exp)
00060         self.assertTrue(predicate(obj), '%s(%s)' % (predicate.__name__, exp))
00061 
00062         for other in self.predicates - set([predicate]):
00063             if predicate == inspect.isgeneratorfunction and\
00064                other == inspect.isfunction:
00065                 continue
00066             self.assertFalse(other(obj), 'not %s(%s)' % (other.__name__, exp))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file test_inspect.py.

00156 
00157     def test_abuse_done(self):
00158         self.istest(inspect.istraceback, 'git.ex[2]')
00159         self.istest(inspect.isframe, 'mod.fr')

Here is the call graph for this function:

Definition at line 180 of file test_inspect.py.

00180 
00181     def test_frame(self):
00182         args, varargs, varkw, locals = inspect.getargvalues(mod.fr)
00183         self.assertEqual(args, ['x', 'y'])
00184         self.assertEqual(varargs, None)
00185         self.assertEqual(varkw, None)
00186         self.assertEqual(locals, {'x': 11, 'p': 11, 'y': 14})
00187         self.assertEqual(inspect.formatargvalues(args, varargs, varkw, locals),
00188                          '(x=11, y=14)')

Here is the call graph for this function:

Definition at line 189 of file test_inspect.py.

00189 
00190     def test_previous_frame(self):
00191         args, varargs, varkw, locals = inspect.getargvalues(mod.fr.f_back)
00192         self.assertEqual(args, ['a', 'b', 'c', 'd', 'e', 'f'])
00193         self.assertEqual(varargs, 'g')
00194         self.assertEqual(varkw, 'h')
00195         self.assertEqual(inspect.formatargvalues(args, varargs, varkw, locals),
00196              '(a=7, b=8, c=9, d=3, e=4, f=5, *g=(), **h={})')

Here is the call graph for this function:

Definition at line 160 of file test_inspect.py.

00160 
00161     def test_stack(self):
00162         self.assertTrue(len(mod.st) >= 5)
00163         self.assertEqual(revise(*mod.st[0][1:]),
00164              (modfile, 16, 'eggs', ['    st = inspect.stack()\n'], 0))
00165         self.assertEqual(revise(*mod.st[1][1:]),
00166              (modfile, 9, 'spam', ['    eggs(b + d, c + f)\n'], 0))
00167         self.assertEqual(revise(*mod.st[2][1:]),
00168              (modfile, 43, 'argue', ['            spam(a, b, c)\n'], 0))
00169         self.assertEqual(revise(*mod.st[3][1:]),
00170              (modfile, 39, 'abuse', ['        self.argue(a, b, c)\n'], 0))

Here is the call graph for this function:

Definition at line 171 of file test_inspect.py.

00171 
00172     def test_trace(self):
00173         self.assertEqual(len(git.tr), 3)
00174         self.assertEqual(revise(*git.tr[0][1:]),
00175              (modfile, 43, 'argue', ['            spam(a, b, c)\n'], 0))
00176         self.assertEqual(revise(*git.tr[1][1:]),
00177              (modfile, 9, 'spam', ['    eggs(b + d, c + f)\n'], 0))
00178         self.assertEqual(revise(*git.tr[2][1:]),
00179              (modfile, 18, 'eggs', ['    q = y / 0\n'], 0))

Here is the call graph for this function:


Member Data Documentation

tuple test.test_inspect.IsTestBase.predicates [static, inherited]
Initial value:
set([inspect.isbuiltin, inspect.isclass, inspect.iscode,
                      inspect.isframe, inspect.isfunction, inspect.ismethod,
                      inspect.ismodule, inspect.istraceback,
                      inspect.isgenerator, inspect.isgeneratorfunction])

Definition at line 52 of file test_inspect.py.


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