Esempio n. 1
0
 def test_cache_works_after_cleanup(self):
     first = func()
     clear_cache(func)
     second = func()
     third = func()
     self.assertNotEqual(first, second)
     self.assertEqual(second, third)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 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)
Esempio n. 6
0
 def test__clear_cache(self):
     self.assertEqual(self.subject.prop, 1)
     clear_cache(self.subject)
     self.assertEqual(self.subject.prop, 2)
Esempio n. 7
0
 def test_clear_cache_works(self):
     before = func()
     clear_cache(func)
     after = func()
     self.assertNotEqual(before, after)
Esempio n. 8
0
 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)