Beispiel #1
0
 def testsimplefunction(self):
     uncache(func_get_a)()
     a1 = func_get_a()
     a2 = func_get_a()
     self.assertEqual(a1, a2)
     b1 = func_get_b()
     b2 = func_get_b()
     self.assertNotEqual(b1, b2)
Beispiel #2
0
 def testsimplefunction(self):
         uncache(func_get_a)()
         a1 = func_get_a()
         a2 = func_get_a()
         self.assertEqual(a1, a2)
         b1 = func_get_b()
         b2 = func_get_b()
         self.assertNotEqual(b1, b2)
Beispiel #3
0
 def testclassmethod(self):
     u = unique()
     TestModel.set_c(u)
     uncache(TestModel.get_c)()
     self.assertEqual(u, TestModel.get_c())
     TestModel.set_c(1)
     self.assertEqual(u, TestModel.get_c())
     TestModel.set_d(u)
     self.assertEqual(u, TestModel.get_d())
     TestModel.set_d(1)
     self.assertNotEqual(u, TestModel.get_d())
Beispiel #4
0
 def testclassmethod(self):
         u = unique()
         TestModel.set_c(u)
         uncache(TestModel.get_c)()
         self.assertEqual(u, TestModel.get_c())
         TestModel.set_c(1)
         self.assertEqual(u, TestModel.get_c())
         TestModel.set_d(u)
         self.assertEqual(u, TestModel.get_d())
         TestModel.set_d(1)
         self.assertNotEqual(u, TestModel.get_d())
Beispiel #5
0
 def testinstancemethod(self):
     t = TestModel()
     u = unique()
     t.set_a(u)
     uncache(t.get_a, parent_keys=['id'])()
     self.assertEqual(u, t.get_a())
     t1 = TestModel()
     self.assertEqual(u, t1.get_a())
     t.set_b(u)
     self.assertEqual(u, t.get_b())
     t.set_b(1)
     self.assertEqual(1, t.get_b())
Beispiel #6
0
 def testinstancemethod(self):
         t = TestModel()
         u = unique()
         t.set_a(u)
         uncache(t.get_a, parent_keys=['id'])()
         self.assertEqual(u, t.get_a())
         t1 = TestModel()
         self.assertEqual(u, t1.get_a())
         t.set_b(u)
         self.assertEqual(u, t.get_b())
         t.set_b(1)
         self.assertEqual(1, t.get_b())
Beispiel #7
0
 def testkwargs(self):
     uncache(func_get_c)()
     c1 = func_get_c()
     c2 = func_get_c()
     self.assertEqual(c1, c2)
     c3 = func_get_c(foo=1)
     self.assertNotEqual(c1, c3)
     c3 = func_get_c(1, 2)
     c4 = func_get_c(foo=1, bar=2)
     c5 = func_get_c(bar=2, foo=1)
     self.assertEqual(c3, c4)
     self.assertEqual(c3, c5)
     uncache(func_get_d)()
     d1 = func_get_d(1, 2)
     d2 = func_get_d(foo=2, bar=1)
     d3 = func_get_d(bar=1, foo=2)
     self.assertEqual(d1, d2)
     self.assertEqual(d1, d3)
Beispiel #8
0
 def testkwargs(self):
         uncache(func_get_c)()
         c1 = func_get_c()
         c2 = func_get_c()
         self.assertEqual(c1, c2)
         c3 = func_get_c(foo=1)
         self.assertNotEqual(c1, c3)
         c3 = func_get_c(1, 2)
         c4 = func_get_c(foo=1, bar=2)
         c5 = func_get_c(bar=2, foo=1)
         self.assertEqual(c3, c4)
         self.assertEqual(c3, c5)
         uncache(func_get_d)()
         d1 = func_get_d(1, 2)
         d2 = func_get_d(foo=2, bar=1)
         d3 = func_get_d(bar=1, foo=2)
         self.assertEqual(d1, d2)
         self.assertEqual(d1, d3)