Ejemplo n.º 1
0
 def testNormalFunction(self): #{{{
     '''Return back normal functions and unbound methods'''
     _ = (lambda: None)
     ub_ = method(_, None, None)
     for f in (_, ub_):
         cw = CallableWrapper(f)
         ret = cw._getref()()
         self.assertEqual(ret, f)
Ejemplo n.º 2
0
 def testDeadReferences(self): #{{{
     '''If the reference dies, return None'''
     class _(object): #{{{
         def me(self): #{{{
             pass
         # End def #}}}
     # End class #}}}
     t = _()
     cw = CallableWrapper(t.me, weak=True)
     del t
     self.assertTrue(cw._getref()() is None)