[Zope3-checkins] CVS: Zope3/src/zope/component/tests - test_api.py:1.14

Jim Fulton jim at zope.com
Fri Mar 5 19:38:48 EST 2004


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

Modified Files:
	test_api.py 
Log Message:
Added an interface __adapt__ hook.


=== Zope3/src/zope/component/tests/test_api.py 1.13 => 1.14 ===
--- Zope3/src/zope/component/tests/test_api.py:1.13	Mon Feb  9 02:41:21 2004
+++ Zope3/src/zope/component/tests/test_api.py	Fri Mar  5 19:38:47 2004
@@ -109,6 +109,12 @@
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
 
+    def testInterfaceCall(self):
+        getService(None, Adapters).provideAdapter(I1, I2, [Comp])
+        c = I2(ob)
+        self.assertEquals(c.__class__, Comp)
+        self.assertEquals(c.context, ob)
+
     def testContextArgument(self):
         # Basically, the same tests as in testAdapter, but with the
         # 'context' argument given. As this is only testing the global
@@ -372,8 +378,19 @@
                           getDefaultViewName,
                           ob, Request(I1))
 
+
+class TestNoSetup(unittest.TestCase):
+
+    def testNotBrokenWhenNoService(self):
+        self.assertRaises(TypeError, I2, ob)
+
+
+
 def test_suite():
-    return unittest.makeSuite(Test)
+    return unittest.TestSuite((
+        unittest.makeSuite(Test),
+        unittest.makeSuite(TestNoSetup),
+        ))
 
 if __name__ == "__main__":
     unittest.TextTestRunner().run(test_suite())




More information about the Zope3-Checkins mailing list