Back to index

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

Classes

class  TestPartial
class  PartialSubclass
class  TestPartialSubclass
class  TestPythonPartial
class  TestUpdateWrapper
class  TestWraps
class  TestReduce
class  TestCmpToKey
class  TestTotalOrdering
class  TestLRU

Functions

def PythonPartial
def capture
def signature
def test_main

Function Documentation

def test.test_functools.capture (   args,
  kw 
)
capture all positional and keyword arguments

Definition at line 22 of file test_functools.py.

00022 
00023 def capture(*args, **kw):
00024     """capture all positional and keyword arguments"""
00025     return args, kw

def test.test_functools.PythonPartial (   func,
  args,
  keywords 
) [static]

Definition at line 11 of file test_functools.py.

00011 
00012 def PythonPartial(func, *args, **keywords):
00013     'Pure Python approximation of partial()'
00014     def newfunc(*fargs, **fkeywords):
00015         newkeywords = keywords.copy()
00016         newkeywords.update(fkeywords)
00017         return func(*(args + fargs), **newkeywords)
00018     newfunc.func = func
00019     newfunc.args = args
00020     newfunc.keywords = keywords
00021     return newfunc

return the signature of a partial object 

Definition at line 26 of file test_functools.py.

00026 
00027 def signature(part):
00028     """ return the signature of a partial object """
00029     return (part.func, part.args, part.keywords, part.__dict__)

Here is the caller graph for this function:

def test.test_functools.test_main (   verbose = None)

Definition at line 658 of file test_functools.py.

00658 
00659 def test_main(verbose=None):
00660     test_classes = (
00661         TestPartial,
00662         TestPartialSubclass,
00663         TestPythonPartial,
00664         TestUpdateWrapper,
00665         TestTotalOrdering,
00666         TestCmpToKey,
00667         TestWraps,
00668         TestReduce,
00669         TestLRU,
00670     )
00671     support.run_unittest(*test_classes)
00672 
00673     # verify reference counting
00674     if verbose and hasattr(sys, "gettotalrefcount"):
00675         import gc
00676         counts = [None] * 5
00677         for i in range(len(counts)):
00678             support.run_unittest(*test_classes)
00679             gc.collect()
00680             counts[i] = sys.gettotalrefcount()
00681         print(counts)