[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests - test_conveniencefunctions.py:1.16 test_traverser.py:1.9

Jim Fulton jim@zope.com
Fri, 18 Apr 2003 18:13:00 -0400


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

Modified Files:
	test_conveniencefunctions.py test_traverser.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/traversing/tests/test_conveniencefunctions.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py:1.15	Tue Apr  8 14:26:34 2003
+++ Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py	Fri Apr 18 18:12:29 2003
@@ -16,6 +16,7 @@
 $Id$
 """
 from unittest import TestCase, main, makeSuite
+from zope.interface import directlyProvides
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.proxy.context import ContextWrapper, isWrapper
 from zope.app.traversing.adapters import Traverser
@@ -49,7 +50,7 @@
         PlacefulSetup.setUp(self)
         # Build up a wrapper chain
         root = C('root')
-        root.__implements__ = IContainmentRoot
+        directlyProvides(root, IContainmentRoot)
         folder = C('folder')
         item = C('item')
 


=== Zope3/src/zope/app/traversing/tests/test_traverser.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/traversing/tests/test_traverser.py:1.8	Tue Feb 11 21:17:40 2003
+++ Zope3/src/zope/app/traversing/tests/test_traverser.py	Fri Apr 18 18:12:29 2003
@@ -17,6 +17,11 @@
 """
 
 import unittest
+
+from zope.interface import directlyProvides
+from zope.interface.verify import verifyClass
+from zope.interface.implements import instancesOfObjectImplements
+
 from zope.app.interfaces.traversing import ITraverser, ITraversable
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
 
@@ -30,8 +35,6 @@
 from zope.component import getService
 from zope.app.services.servicenames import Adapters
 
-from zope.interface.verify import verifyClass
-from zope.interface.implements import instancesOfObjectImplements
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.security.checker \
     import ProxyFactory, defineChecker, CheckerPublic, Checker
@@ -61,7 +64,7 @@
 class UnrestrictedNoTraverseTests(unittest.TestCase):
     def setUp(self):
         self.root = root = C('root')
-        self.root.__implements__ = IContainmentRoot
+        directlyProvides(self.root, IContainmentRoot)
         self.folder = folder = C('folder')
         self.item = item = C('item')
 
@@ -87,7 +90,7 @@
               IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
 
         self.root = root = C('root')
-        self.root.__implements__ = IContainmentRoot
+        directlyProvides(self.root, IContainmentRoot)
         self.folder = folder = C('folder')
         self.item = item = C('item')
 
@@ -161,7 +164,7 @@
               IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
 
         self.root = root = C('root')
-        root.__implements__ = IContainmentRoot
+        directlyProvides(root, IContainmentRoot)
         self.folder = folder = C('folder')
         self.item = item = C('item')