[Zodb-checkins] CVS: Zope3/src/zope/interface/tests - test_surrogate.py:1.1.2.3

Jim Fulton cvs-admin at zope.org
Mon Nov 10 15:45:22 EST 2003


Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv24129/tests

Modified Files:
      Tag: adaptergeddon-branch
	test_surrogate.py 
Log Message:
Changed the strategy for maintaining the implied mapping to
use local (to surrogates) implied and multi-implied mappings that get
merged to make the overall implied mapping.  This makes the
computation go a bit faster, especially when there are updates.


=== Zope3/src/zope/interface/tests/test_surrogate.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/interface/tests/test_surrogate.py:1.1.2.2	Sun Nov  9 11:08:34 2003
+++ Zope3/src/zope/interface/tests/test_surrogate.py	Mon Nov 10 15:45:20 2003
@@ -78,6 +78,60 @@
     
     """
 
+def test_multi_adapter_w_inherited_and_multiple_registrations():
+    """
+    >>> import zope.interface
+    >>> class IF0(zope.interface.Interface):
+    ...     pass
+    >>> class IF1(IF0):
+    ...     pass
+
+
+    >>> class IR0(zope.interface.Interface):
+    ...     pass
+    >>> class IR1(IR0):
+    ...     pass
+
+    >>> class F1:
+    ...     zope.interface.implements(IF1)
+    >>> c = F1()
+
+    >>> class R1:
+    ...     zope.interface.implements(IR1)
+    >>> r = R1()
+
+    >>> registry = SurrogateRegistry()
+
+    >>> class IB0(zope.interface.Interface):
+    ...     pass
+    >>> class IB1(IB0):
+    ...     pass
+
+    >>> class f1:
+    ...     def __init__(self, x, y):
+    ...         self.x, self.y = x, y
+
+    >>> class IX(zope.interface.Interface):
+    ...    pass
+
+    >>> class fx:
+    ...     def __init__(self, x, y):
+    ...         self.x, self.y = x, y
+    
+    >>> registry.provideAdapter(IF0, IB1, [f1], name='bob', with=[IR0])
+    >>> registry.provideAdapter(IF1, IB1, [fx], name='bob', with=[IX])
+
+    >>> a = registry.queryMultiAdapter((c, r), IB0, 'bob')
+    >>> a.__class__ is f1
+    True
+    >>> a.x is c
+    True
+    >>> a.y is r
+    True
+    
+    
+    """
+
 def test_named_adapter_with_default():
     """Query a named simple adapter
 




More information about the Zodb-checkins mailing list