[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_adapter.py:1.10 test_view.py:1.10

Jim Fulton jim@zope.com
Fri, 18 Apr 2003 18:12:59 -0400


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

Modified Files:
	test_adapter.py test_view.py 
Log Message:
In prepration for the upcoming interface changes, I added some
new functions for making interface assertions on instances.  

Rather than:

  class C:

     __class_implements__ = I1, I2

use:

  class C:

     classProvides(I1, I2)

rather than:

__implements__ = I1, I2

use:

moduleProvides(I1, I2)

rather than:

someinstance.__implements__ = I1, I2

use:

directlyProvides(I1, I2)

Note that interface assertions on persistent objects should be aboided
since the internal representation will change.

Continue to make assertions about the interfaces that class instances
implement the same way:

  class C:

     __implements__ = I1, I2


I also modified the core software to use the new spellings.



=== Zope3/src/zope/app/services/tests/test_adapter.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/services/tests/test_adapter.py:1.9	Mon Apr  7 07:30:10 2003
+++ Zope3/src/zope/app/services/tests/test_adapter.py	Fri Apr 18 18:12:28 2003
@@ -19,7 +19,7 @@
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.services.tests.iconfigurable import TestingIConfigurable
 from zope.app.services.adapter import AdapterService
-from zope.interface import Interface
+from zope.interface import Interface, directlyProvides
 from zope.proxy.context import ContextWrapper
 from zope.component.exceptions import ComponentLookupError
 from zope.app.services.tests.placefulsetup import PlacefulSetup
@@ -134,7 +134,7 @@
             for r in I1, I1E:
                 for p in I2B, I2:
                     o = O()
-                    o.__implements__ = r
+                    directlyProvides(o, r)
 
                     adapter = getattr(service, m)(o, p,)
                     self.assertEqual(adapter.__class__, A)
@@ -172,7 +172,7 @@
         for r in I1, I1E:
             for p in I2B, I2:
                 o = O()
-                o.__implements__ = r
+                directlyProvides(o, r)
 
                 adapter = service.getAdapter(o, p, u"Yatta!")
                 self.assertEqual(adapter.__class__, A)
@@ -184,7 +184,7 @@
         for r in I1, I1E:
             for p in I2B, I2:
                 o = O()
-                o.__implements__ = r
+                directlyProvides(o, r)
 
                 adapter = service.queryAdapter(o, p, None, u"Yatta!")
                 self.assertEqual(adapter.__class__, A)


=== Zope3/src/zope/app/services/tests/test_view.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/services/tests/test_view.py:1.9	Sun Mar 23 17:35:42 2003
+++ Zope3/src/zope/app/services/tests/test_view.py	Fri Apr 18 18:12:28 2003
@@ -19,7 +19,7 @@
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.services.tests.iconfigurable import TestingIConfigurable
 from zope.app.services.view import ViewService
-from zope.interface import Interface
+from zope.interface import Interface, directlyProvides
 from zope.proxy.context import ContextWrapper
 from zope.component.exceptions import ComponentLookupError
 from zope.app.services.tests.placefulsetup import PlacefulSetup
@@ -148,7 +148,7 @@
         for m in 'queryView', 'getView':
             for r in I1, I1E:
                 o = O()
-                o.__implements__ = r
+                directlyProvides(o, r)
 
                 view = getattr(service, m)(o, 'test', request)
                 self.assertEqual(view.__class__, A)