[Zope3-checkins] CVS: Zope3/src/zope/interface/tests -
iadapter.py:1.4.36.1 test_surrogate.py:1.1.2.5
Jim Fulton
cvs-admin at zope.org
Tue Nov 18 17:27:18 EST 2003
Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv19243/src/zope/interface/tests
Modified Files:
Tag: adaptergeddon-branch
iadapter.py test_surrogate.py
Log Message:
Implemented local presentation services.
=== Zope3/src/zope/interface/tests/iadapter.py 1.4 => 1.4.36.1 ===
--- Zope3/src/zope/interface/tests/iadapter.py:1.4 Sat May 3 12:37:26 2003
+++ Zope3/src/zope/interface/tests/iadapter.py Tue Nov 18 17:26:42 2003
@@ -165,7 +165,7 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- required_interfaces = (R1, )
+ required = (R1, )
))
got.sort()
expect = [
@@ -179,7 +179,7 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- required_interfaces = (R12, R2)
+ required = (R12, R2)
))
got.sort()
expect = [
@@ -193,9 +193,7 @@
def test_getRegisteredMatching_provided_P1(self):
registry = self.__registery()
- got = list(registry.getRegisteredMatching(
- provided_interfaces = (P1, )
- ))
+ got = list(registry.getRegisteredMatching(provided = (P1, )))
got.sort()
expect = [
(None, P3, 'default P3'),
@@ -209,7 +207,7 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- provided_interfaces = (P3, )
+ provided = (P3, )
))
got.sort()
expect = [
@@ -224,8 +222,8 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- required_interfaces = (R4, R12),
- provided_interfaces = (P1, ),
+ required = (R4, R12),
+ provided = (P1, ),
))
got.sort()
expect = [
@@ -240,8 +238,8 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- required_interfaces = (R4, R12),
- provided_interfaces = (P3, ),
+ required = (R4, R12),
+ provided = (P3, ),
))
got.sort()
expect = [
@@ -257,8 +255,8 @@
registry = self.__registery()
got = list(registry.getRegisteredMatching(
- required_interfaces = (R2, ),
- provided_interfaces = (P3, ),
+ required = (R2, ),
+ provided = (P3, ),
))
got.sort()
expect = [
=== Zope3/src/zope/interface/tests/test_surrogate.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/interface/tests/test_surrogate.py:1.1.2.4 Thu Nov 13 12:33:01 2003
+++ Zope3/src/zope/interface/tests/test_surrogate.py Tue Nov 18 17:26:42 2003
@@ -188,6 +188,77 @@
"""
+def test_getRegisteredMatching_with_with():
+ """
+ >>> registry = SurrogateRegistry()
+ >>> registry.provideAdapter(None, IB0, '_0')
+ >>> registry.provideAdapter(IF0, IB0, '00')
+ >>> registry.provideAdapter(IF1, IB0, '10')
+ >>> registry.provideAdapter(IF1, IB1, '11')
+ >>> registry.provideAdapter(IF0, IB0, '000', with=(IR0,))
+ >>> registry.provideAdapter(IF1, IB0, '100', with=(IR0,))
+ >>> registry.provideAdapter(IF1, IB1, '110', with=(IR0,))
+ >>> registry.provideAdapter(IF0, IB0, '001', with=(IR1,))
+ >>> registry.provideAdapter(IF1, IB0, '101', with=(IR1,))
+ >>> registry.provideAdapter(IF1, IB1, '111', with=(IR1,))
+
+ >>> from pprint import PrettyPrinter
+ >>> pprint = PrettyPrinter(width=60).pprint
+ >>> def sorted(x):
+ ... x = [(getattr(r, '__name__', None), p.__name__,
+ ... [w.__name__ for w in rwith], n, f)
+ ... for (r, p, rwith, n, f) in x]
+ ... x.sort()
+ ... pprint(x)
+
+ >>> sorted(registry.getRegisteredMatching())
+ [(None, 'IB0', [], u'', '_0'),
+ ('IF0', 'IB0', [], u'', '00'),
+ ('IF0', 'IB0', ['IR0'], u'', '000'),
+ ('IF0', 'IB0', ['IR1'], u'', '001'),
+ ('IF1', 'IB0', [], u'', '10'),
+ ('IF1', 'IB0', ['IR0'], u'', '100'),
+ ('IF1', 'IB0', ['IR1'], u'', '101'),
+ ('IF1', 'IB1', [], u'', '11'),
+ ('IF1', 'IB1', ['IR0'], u'', '110'),
+ ('IF1', 'IB1', ['IR1'], u'', '111')]
+ >>> sorted(registry.getRegisteredMatching(required=[IF0]))
+ [(None, 'IB0', [], u'', '_0'),
+ ('IF0', 'IB0', [], u'', '00'),
+ ('IF0', 'IB0', ['IR0'], u'', '000'),
+ ('IF0', 'IB0', ['IR1'], u'', '001')]
+ >>> sorted(registry.getRegisteredMatching(required=[IF1],
+ ... provided=[IB0]))
+ [(None, 'IB0', [], u'', '_0'),
+ ('IF0', 'IB0', [], u'', '00'),
+ ('IF0', 'IB0', ['IR0'], u'', '000'),
+ ('IF0', 'IB0', ['IR1'], u'', '001'),
+ ('IF1', 'IB0', [], u'', '10'),
+ ('IF1', 'IB0', ['IR0'], u'', '100'),
+ ('IF1', 'IB0', ['IR1'], u'', '101'),
+ ('IF1', 'IB1', [], u'', '11'),
+ ('IF1', 'IB1', ['IR0'], u'', '110'),
+ ('IF1', 'IB1', ['IR1'], u'', '111')]
+ >>> sorted(registry.getRegisteredMatching(required=[IF1],
+ ... provided=[IB0],
+ ... with=[IR0]))
+ [('IF0', 'IB0', ['IR0'], u'', '000'),
+ ('IF1', 'IB0', ['IR0'], u'', '100'),
+ ('IF1', 'IB1', ['IR0'], u'', '110')]
+ >>> sorted(registry.getRegisteredMatching(required=[IF1],
+ ... provided=[IB0],
+ ... with=[IR1]))
+ [('IF0', 'IB0', ['IR0'], u'', '000'),
+ ('IF0', 'IB0', ['IR1'], u'', '001'),
+ ('IF1', 'IB0', ['IR0'], u'', '100'),
+ ('IF1', 'IB0', ['IR1'], u'', '101'),
+ ('IF1', 'IB1', ['IR0'], u'', '110'),
+ ('IF1', 'IB1', ['IR1'], u'', '111')]
+ """
+
+
+
+
def test_suite():
return unittest.TestSuite((
DocTestSuite('zope.interface.surrogate'),
More information about the Zope3-Checkins
mailing list