Exemplo n.º 1
0
    def test_returning_correct_value(self):

        func = self.create_mock(return_value='some_retval')
        decorated_func = CachedFunctionDecorator(func, cacher=self.cacher)

        decorated_func.warm()

        assert decorated_func() == 'some_retval'
Exemplo n.º 2
0
    def test_invalidate(self):
        func = self.create_mock(return_value='testing')
        decorated_func = CachedFunctionDecorator(func, cacher=self.cacher)

        decorated_func(1)

        assert decorated_func.is_cached(1) == True

        decorated_func.invalidate(1)

        assert decorated_func.is_cached(1) == False