def test_classmethod(self): """Test deferring a class method.""" x = DeferredClass(5) d = defer(x.calc, 1) d_str = pickle.dumps(d) d_new = pickle.loads(d_str) result = d_new.run() self.assertEqual(result, 26) self.assertEqual(d_new.result, 26)
def test_straightup(self): """Test direct deferring of a function call.""" d = defer(factorial, 4) r = d.run() self.assertEqual(d.result, 24)