[Zope3-checkins] CVS: Zope3/src/zope/component/tests -
test_adapter.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Apr 15 09:26:21 EDT 2004
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv10343/src/zope/component/tests
Modified Files:
test_adapter.py
Log Message:
No doc tests in zope.component.adapter left.
Remove all 'getRegisteredMatching()' tests.
=== Zope3/src/zope/component/tests/test_adapter.py 1.4 => 1.5 ===
--- Zope3/src/zope/component/tests/test_adapter.py:1.4 Wed Apr 7 15:18:58 2004
+++ Zope3/src/zope/component/tests/test_adapter.py Thu Apr 15 09:26:21 2004
@@ -11,159 +11,17 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+"""Global Adapter Service Tests
+$Id$
+"""
import unittest
+from doctest import DocTestSuite
from zope.component.adapter import GlobalAdapterService
-from zope.interface import Interface
-
-class R1(Interface): pass
-class R12(Interface): pass
-class R2(R1): pass
-class R3(R2): pass
-class R4(R3): pass
-
-class P1(Interface): pass
-class P2(P1): pass
-class P3(P2): pass
-class P4(P3): pass
-
-class default_P3: pass
-class any_P3: pass
-class R2_P3: pass
class GlobalAdapterServiceTests(unittest.TestCase):
- def getRegistry(self):
- registry = GlobalAdapterService()
-
- registry.register([None], P3, '', default_P3)
- registry.register([Interface], P3, '', any_P3)
- registry.register([R2], P3, '', R2_P3)
-
- return registry
-
- def test_getRegisteredMatching_all(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching())
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_for_R1(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- required = (R1, )
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_for_multiple(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- required = (R12, R2)
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_provided_P1(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- provided = (P1, )
- ))
-
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_provided_P2(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- provided = (P3, )
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_for_and_provided_1(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- required = (R4, R12),
- provided = (P1, ),
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_for_and_provided_2(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- required = (R4, R12),
- provided = (P3, ),
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
- def test_getRegisteredMatching_for_and_provided_exact(self):
- registry = self.getRegistry()
-
- got = list(registry.getRegisteredMatching(
- required = (R2, ),
- provided = (P3, ),
- ))
- got.sort()
- expect = [
- (Interface, P3, (), u'', any_P3),
- (R2, P3, (), u'', R2_P3),
- (None, P3, (), u'', default_P3),
- ]
- expect.sort()
- self.assertEqual(got, expect)
-
def test_pickling(self):
from zope.component.tests.test_service import testServiceManager
from zope.component.interfaces import IAdapterService
@@ -179,6 +37,5 @@
def test_suite():
suite = unittest.makeSuite(GlobalAdapterServiceTests)
- from doctest import DocTestSuite
suite.addTest(DocTestSuite('zope.component.adapter'))
return suite
More information about the Zope3-Checkins
mailing list