コード例 #1
0
 def testDefaults(self): #{{{
     '''Function with default values'''
     t = lambda a, b, c=1, d=2: None
     self.assertEqual(nsa(t), (2, 4))
コード例 #2
0
 def testNoDefaults(self): #{{{
     '''Function with no default values'''
     t = lambda a, b, c: None
     self.assertEqual(nsa(t), (3, 3))
コード例 #3
0
 def testVarArgs(self): #{{{
     '''Function with variable args'''
     t = lambda *a: None
     self.assertEqual(nsa(t), (0, None))
     t = lambda a, b, *c: None
     self.assertEqual(nsa(t), (2, None))
コード例 #4
0
 def testNonCallableObject(self): #{{{
     '''Object with non-method __call__'''
     class _(object): 
         __call__ = 1
     self.assertEqual(nsa(_()), (-1, None))
コード例 #5
0
 def testClass(self): #{{{
     '''Class objects are valid callables'''
     class _(object): 
         def __init__(self):
             pass
     self.assertEqual(nsa(_), (0, 0))
コード例 #6
0
 def testNonCallable(self): #{{{
     '''Non-callable returns (-1, None)'''
     self.assertEqual(nsa(1), (-1, None))