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)
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)