All pastes #467323 Raw Edit

Unnamed

public python v1 · immutable
·published 2007-05-02 13:29 UTC
rendered paste body
class EcsCacheTest(unittest.TestCase):    @memoize    def empty_method(self):        global has_been_called        has_been_called = True        return 'empty_method'    @memoize    def sum(self, a, b):        global has_been_called        has_been_called = True        return a+b    @memoize    def multi(self, a, b):        global has_been_called        has_been_called = True        return a*b    def test_different_function(self):        # two functions could have sames arguments but not same return        # So build the key with only args et kw it's not sure        self.assertEqual(self.sum(3, 4), 7)        self.assertEqual(has_been_called, True)        self.assertEqual(self.multi(3, 4), 12)        self.assertEqual(has_been_called, True)