Пример #1
0
 def test_most_specific_interface_wins(self):
     from z3c.caching.registry import register, lookup
     register(ITestView, "frop")
     register(IMoreSpecificTestView, "fribble")
     i=OtherTestView()
     self.assertEqual(lookup(i), "fribble")
Пример #2
0
 def test_unregistering_ruleset_removes_ruleset(self):
     from z3c.caching.registry import register, unregister, lookup
     register(TestView, "frop")
     unregister(TestView)
     self.failUnless(lookup(TestView) is None)
Пример #3
0
 def test_ruleset_for_interface(self):
     from z3c.caching.registry import register, lookup
     register(ITestView, "frop")
     i=TestView()
     self.assertEqual(lookup(i), "frop")
Пример #4
0
 def test_unregistering_ruleset_removes_ruleset(self):
     from z3c.caching.registry import register, unregister, lookup
     register(TestView, "frop")
     unregister(TestView)
     self.failUnless(lookup(TestView) is None)
Пример #5
0
 def test_most_specific_interface_wins(self):
     from z3c.caching.registry import register, lookup
     register(ITestView, "frop")
     register(IMoreSpecificTestView, "fribble")
     i = OtherTestView()
     self.assertEqual(lookup(i), "fribble")
Пример #6
0
 def test_ruleset_for_interface(self):
     from z3c.caching.registry import register, lookup
     register(ITestView, "frop")
     i = TestView()
     self.assertEqual(lookup(i), "frop")
Пример #7
0
 def test_register(self):
     from z3c.caching.registry import register
     with self.assertRaises(LookupError):
         register(TestView, 'testrule')