Back to index

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

List of all members.

Public Member Functions

def test_oneline_lambda
def test_threeline_lambda
def test_twoline_indented_lambda
def test_onelinefunc
def test_manyargs
def test_twolinefunc
def test_lambda_in_list
def test_anonymous
def sourcerange
def assertSourceEqual

Public Attributes

 source

Static Public Attributes

 fodderModule = mod2

Detailed Description

Definition at line 327 of file test_inspect.py.


Member Function Documentation

def test.test_inspect.GetSourceBase.assertSourceEqual (   self,
  obj,
  top,
  bottom 
) [inherited]

Definition at line 211 of file test_inspect.py.

00211 
00212     def assertSourceEqual(self, obj, top, bottom):
00213         self.assertEqual(inspect.getsource(obj),
00214                          self.sourcerange(top, bottom))

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_inspect.GetSourceBase.sourcerange (   self,
  top,
  bottom 
) [inherited]

Definition at line 207 of file test_inspect.py.

00207 
00208     def sourcerange(self, top, bottom):
00209         lines = self.source.split("\n")
00210         return "\n".join(lines[top-1:bottom]) + "\n"

Here is the caller graph for this function:

Definition at line 364 of file test_inspect.py.

00364 
00365     def test_anonymous(self):
00366         # Test inspect.getsource with a lambda function defined
00367         # as argument to another function.
00368         self.assertSourceEqual(mod2.anonymous, 55, 55)

Here is the call graph for this function:

Definition at line 359 of file test_inspect.py.

00359 
00360     def test_lambda_in_list(self):
00361         # Test inspect.getsource with a one-line lambda function
00362         # defined in a list, indented.
00363         self.assertSourceEqual(mod2.a[1], 49, 49)

Here is the call graph for this function:

Definition at line 347 of file test_inspect.py.

00347 
00348     def test_manyargs(self):
00349         # Test inspect.getsource with a regular function where
00350         # the arguments are on two lines and _not_ indented and
00351         # the body on the second line with the last arguments.
00352         self.assertSourceEqual(mod2.manyargs, 40, 41)

Here is the call graph for this function:

Definition at line 329 of file test_inspect.py.

00329 
00330     def test_oneline_lambda(self):
00331         # Test inspect.getsource with a one-line lambda function.
00332         self.assertSourceEqual(mod2.oll, 25, 25)

Here is the call graph for this function:

Definition at line 343 of file test_inspect.py.

00343 
00344     def test_onelinefunc(self):
00345         # Test inspect.getsource with a regular one-line function.
00346         self.assertSourceEqual(mod2.onelinefunc, 37, 37)

Here is the call graph for this function:

Definition at line 333 of file test_inspect.py.

00333 
00334     def test_threeline_lambda(self):
00335         # Test inspect.getsource with a three-line lambda function,
00336         # where the second and third lines are _not_ indented.
00337         self.assertSourceEqual(mod2.tll, 28, 30)

Here is the call graph for this function:

Definition at line 338 of file test_inspect.py.

00338 
00339     def test_twoline_indented_lambda(self):
00340         # Test inspect.getsource with a two-line lambda function,
00341         # where the second line _is_ indented.
00342         self.assertSourceEqual(mod2.tlli, 33, 34)

Here is the call graph for this function:

Definition at line 353 of file test_inspect.py.

00353 
00354     def test_twolinefunc(self):
00355         # Test inspect.getsource with a regular function where
00356         # the body is on two lines, following the argument list and
00357         # continued on the next line by a \\.
00358         self.assertSourceEqual(mod2.twolinefunc, 44, 45)

Here is the call graph for this function:


Member Data Documentation

Reimplemented from test.test_inspect.GetSourceBase.

Definition at line 328 of file test_inspect.py.

Definition at line 205 of file test_inspect.py.


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