def test_cache_works_after_cleanup(self): first = func() clear_cache(func) second = func() third = func() self.assertNotEqual(first, second) self.assertEqual(second, third)
def test__kwargs(self): clear_cache(self.subject) self.assertEqual(self.subject.cached_method_3(value=1), 1) self.assertEqual(self.subject.cached_method_3(value=1), 1) self.assertEqual(self.subject.cached_method_3(value=2), 2) self.assertEqual(self.subject.cached_method_3(value=2), 2)
def test__mutable_args(self): clear_cache(self.subject) self.assertEqual(self.subject.cached_method_3([1]), 1) self.assertEqual(self.subject.cached_method_3([1]), 2)
def test__args(self): clear_cache(self.subject) self.assertEqual(self.subject.cached_method_3(1), 1) self.assertEqual(self.subject.cached_method_3(1), 1) self.assertEqual(self.subject.cached_method_3(2), 2) self.assertEqual(self.subject.cached_method_3(2), 2)
def test__clear_cache(self): self.assertEqual(self.subject.cached_method_1(1), 1) self.assertEqual(self.subject.cached_method_1(1), 1) clear_cache(self.subject) self.assertEqual(self.subject.cached_method_1(1), 2)
def test__clear_cache(self): self.assertEqual(self.subject.prop, 1) clear_cache(self.subject) self.assertEqual(self.subject.prop, 2)
def test_clear_cache_works(self): before = func() clear_cache(func) after = func() self.assertNotEqual(before, after)
def test__no_args_and_kwargs(self): clear_cache(self.subject) self.assertEqual(self.subject.cached_method_4(), 1) self.assertEqual(self.subject.prop, 2) self.assertEqual(self.subject.cached_method_4(), 1) clear_cache(self.subject)