[Zope-Checkins] CVS: Zope3/lib/python/Interface/Registry/tests - TestIAdapterRegistry.py:1.2.8.4

Jim Fulton jim@zope.com
Thu, 24 Oct 2002 07:08:38 -0400


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

Modified Files:
      Tag: Zope3-Bangalore-TTW-Branch
	TestIAdapterRegistry.py 
Log Message:
Fixed bug in getRegisteredMatching that failed caused data to be
ommitted that was registered to provide the requested interface.


=== Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py 1.2.8.3 => 1.2.8.4 ===
--- Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py:1.2.8.3	Thu Oct 24 01:52:05 2002
+++ Zope3/lib/python/Interface/Registry/tests/TestIAdapterRegistry.py	Thu Oct 24 07:08:37 2002
@@ -188,7 +188,7 @@
         expect.sort()
         self.assertEqual(got, expect)
 
-    def test_getRegisteredMatching_provided_1(self):
+    def test_getRegisteredMatching_provided_P1(self):
         registry = self.__registery()
         
         got = list(registry.getRegisteredMatching(
@@ -203,6 +203,21 @@
         expect.sort()
         self.assertEqual(got, expect)
 
+    def test_getRegisteredMatching_provided_P2(self):
+        registry = self.__registery()
+        
+        got = list(registry.getRegisteredMatching(
+            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_1(self):
         registry = self.__registery()
         
@@ -224,6 +239,23 @@
         
         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()