[Zope3-checkins] CVS: Zope3/src/zope/app/component/tests - test_directives.py:1.5

Jim Fulton jim@zope.com
Wed, 21 May 2003 16:29:40 -0400


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

Modified Files:
	test_directives.py 
Log Message:
Changed the API for handling named adapters.  There is1
now a separate cleaner api for getting named adapters.


=== Zope3/src/zope/app/component/tests/test_directives.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/component/tests/test_directives.py:1.4	Mon May 12 12:32:40 2003
+++ Zope3/src/zope/app/component/tests/test_directives.py	Wed May 21 16:29:10 2003
@@ -26,6 +26,9 @@
 from zope.component import getView, queryView, queryResource
 from zope.component import createObject
 from zope.component import getDefaultViewName
+from zope.component import getAdapter, queryAdapter
+from zope.component import getNamedAdapter, queryNamedAdapter
+from zope.component import getUtility, queryUtility
 
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.component.tests.views import IV, IC, V1, VZMI, R1, RZMI
@@ -55,7 +58,6 @@
         XMLConfig('meta.zcml', zope.app.security)()
 
     def testAdapter(self):
-        from zope.component import getAdapter, queryAdapter
 
         # Full import is critical!
         from zope.component.tests.components import Content, IApp, Comp
@@ -76,14 +78,13 @@
 
     def testNamedAdapter(self):
 
-        from zope.component import getAdapter, queryAdapter
 
         # Full import is critical!
         from zope.component.tests.components import Content, IApp, Comp
 
         self.testAdapter()
         self.assertEqual(getAdapter(Content(), IApp).__class__, Comp)
-        self.assertEqual(queryAdapter(Content(), IV, None, name='test'),
+        self.assertEqual(queryNamedAdapter(Content(), IV, 'test'),
                          None)
 
         xmlconfig(StringIO(template % (
@@ -97,11 +98,10 @@
             """
             )))
 
-        self.assertEqual(getAdapter(Content(), IApp, name="test").__class__,
+        self.assertEqual(getNamedAdapter(Content(), IApp, "test").__class__,
                          Comp)
 
     def testProtectedAdapter(self):
-        from zope.component import getAdapter, queryAdapter
 
         # Full import is critical!
         from zope.component.tests.components import Content, IApp, Comp
@@ -139,7 +139,6 @@
                           testing=1)
 
     def testUtility(self):
-        from zope.component import getUtility, queryUtility
 
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
@@ -158,7 +157,6 @@
         self.assertEqual(getUtility(None, IApp), comp)
 
     def testNamedUtility(self):
-        from zope.component import getUtility, queryUtility
 
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
@@ -180,7 +178,6 @@
         self.assertEqual(getUtility(None, IApp, "test"), comp)
 
     def testUtilityFactory(self):
-        from zope.component import getUtility, queryUtility
 
         # Full import is critical!
         from zope.component.tests.components import IApp, Comp
@@ -199,7 +196,6 @@
         self.assertEqual(getUtility(None, IApp).__class__, Comp)
 
     def testProtectedUtility(self):
-        from zope.component import getUtility, queryUtility
 
         # Full import is critical!
         from zope.component.tests.components import IApp, comp