[Zodb-checkins] CVS: Zope3/lib/python/Interface/Registry/tests - TestIAdapterRegistry.py:1.2.8.5

Jim Fulton jim@zope.com
Wed, 13 Nov 2002 15:23:49 -0500


Update of /cvs-repository/Zope3/lib/python/Interface/Registry/tests
In directory cvs.zope.org:/tmp/cvs-serv568/lib/python/Interface/Registry/tests

Modified Files:
      Tag: Zope3-Bangalore-TTW-Branch
	TestIAdapterRegistry.py 
Log Message:
fixed DOS line endings

=== Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py 1.2.8.4 => 1.2.8.5 === (447/547 lines abridged)
--- Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py:1.2.8.4	Thu Oct 24 07:08:37 2002
+++ Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py	Wed Nov 13 15:23:17 2002
@@ -1,272 +1,272 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-Revision information:
-$Id$
-"""
-
-from 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 TestIAdapterRegistry:
-
-    def testImplementsIAdapterRegistry(self):
-        from Interface.Verify import verifyObject
-        from Interface.Registry.IAdapterRegistry import IAdapterRegistry
-        
-        registry = self._TestIAdapterRegistry__new()
-
-        verifyObject(IAdapterRegistry, registry)
-
-    def __registery(self):        
-        registry = self._TestIAdapterRegistry__new()
-
-        registry.register(None, P3, 'default P3')
-        registry.register(Interface, P3, 'any P3')

[-=- -=- -=- 447 lines omitted -=- -=- -=-]

+        
+        got = list(registry.getRegisteredMatching(
+            required_interfaces = (R4, R12),
+            provided_interfaces = (P1, ),
+            ))
+        got.sort()
+        expect = [
+            (None, P3, 'default P3'),
+            (Interface, P3, 'any P3'),
+            (R2, P3, 'R2 P3'),
+            ]
+        expect.sort()
+        self.assertEqual(got, expect)
+
+    def test_getRegisteredMatching_required_and_provided_2(self):
+        registry = self.__registery()
+        
+        got = list(registry.getRegisteredMatching(
+            required_interfaces = (R4, R12),
+            provided_interfaces = (P3, ),
+            ))
+        got.sort()
+        expect = [
+            (None, P3, 'default P3'),
+            (Interface, P3, 'any P3'),
+            (R2, P3, 'R2 P3'),
+            ]
+        expect.sort()
+        self.assertEqual(got, expect)
+        
+
+    def test_getRegisteredMatching_required_and_provided_exact(self):
+        registry = self.__registery()
+        
+        got = list(registry.getRegisteredMatching(
+            required_interfaces = (R2, ),
+            provided_interfaces = (P3, ),
+            ))
+        got.sort()
+        expect = [
+            (None, P3, 'default P3'),
+            (Interface, P3, 'any P3'),
+            (R2, P3, 'R2 P3'),
+            ]
+        expect.sort()
+        self.assertEqual(got, expect)
+        
+        
+        
+