[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests - test_acquire.py:1.5.10.1 test_conveniencefunctions.py:1.16.12.1 test_namespacetrversal.py:1.4.10.1 test_physicallocationadapters.py:1.7.10.1 test_presentation.py:1.4.10.1 test_traverser.py:1.9.12.1 test_objectname.py:NONE
Grégoire Weber
zope@i-con.ch
Sun, 22 Jun 2003 10:24:05 -0400
Update of /cvs-repository/Zope3/src/zope/app/traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/traversing/tests
Modified Files:
Tag: cw-mail-branch
test_acquire.py test_conveniencefunctions.py
test_namespacetrversal.py test_physicallocationadapters.py
test_presentation.py test_traverser.py
Removed Files:
Tag: cw-mail-branch
test_objectname.py
Log Message:
Synced up with HEAD
=== Zope3/src/zope/app/traversing/tests/test_acquire.py 1.5 => 1.5.10.1 ===
--- Zope3/src/zope/app/traversing/tests/test_acquire.py:1.5 Thu May 1 15:35:38 2003
+++ Zope3/src/zope/app/traversing/tests/test_acquire.py Sun Jun 22 10:23:34 2003
@@ -22,7 +22,7 @@
from zope.app.interfaces.traversing import ITraversable
from zope.app.traversing.adapters import DefaultTraversable
from zope.component.adapter import provideAdapter
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
from zope.app.traversing.namespace import acquire
from zope.exceptions import NotFoundError
=== Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py 1.16 => 1.16.12.1 ===
--- Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py:1.16 Fri Apr 18 18:12:29 2003
+++ Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py Sun Jun 22 10:23:34 2003
@@ -18,13 +18,13 @@
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.context import ContextWrapper
+from zope.context import isWrapper
from zope.app.traversing.adapters import Traverser
from zope.component import getService
from zope.app.services.servicenames import Adapters
from zope.app.interfaces.traversing import ITraverser, ITraversable
-from zope.app.interfaces.traversing import IObjectName
-from zope.app.traversing.adapters import DefaultTraversable, ObjectName
+from zope.app.traversing.adapters import DefaultTraversable
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.interfaces.traversing import IContainmentRoot
@@ -72,13 +72,10 @@
getService(None, Adapters).provideAdapter(
None, ITraversable, DefaultTraversable)
getService(None, Adapters).provideAdapter(
- None, IObjectName, ObjectName)
- getService(None, Adapters).provideAdapter(
None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
getService(None, Adapters).provideAdapter(
IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
-
def testTraverse(self):
from zope.app.traversing import traverse
self.assertEqual(
@@ -129,18 +126,18 @@
self.folder, './item'
)
- def testObjectName(self):
- from zope.app.traversing import objectName
+ def testGetName(self):
+ from zope.app.traversing import getName
self.assertEqual(
- objectName(self.item),
+ getName(self.item),
'item'
)
- def testObjectNameFromUnwrapped(self):
- from zope.app.traversing import objectName
+ def testGetNameFromUnwrapped(self):
+ from zope.app.traversing import getName
self.assertRaises(
TypeError,
- objectName,
+ getName,
self.unwrapped_item
)
@@ -213,21 +210,28 @@
self.unwrapped_item
)
- def testGetPhysicalPathString(self):
+ def testGetPath(self):
from zope.app.traversing import getPath
self.assertEqual(
getPath(self.item),
u'/folder/item'
)
- def testGetPhysicalPathStringOfRoot(self):
+ def testGetPathOfRoot(self):
from zope.app.traversing import getPath
self.assertEqual(
getPath(self.root),
u'/',
)
- def testGetPhysicalRoot(self):
+ def testGetNameOfRoot(self):
+ from zope.app.traversing import getName
+ self.assertEqual(
+ getName(self.root),
+ u'',
+ )
+
+ def testGetRoot(self):
from zope.app.traversing import getRoot
self.assertEqual(
getRoot(self.item),
=== Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py 1.4 => 1.4.10.1 ===
--- Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py:1.4 Thu May 1 15:35:38 2003
+++ Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py Sun Jun 22 10:23:34 2003
@@ -52,7 +52,8 @@
def testSideEffectsContextDetail(self):
# Check to make sure that when we traverse something in context,
# that we get the right context for the result.
- from zope.proxy.context import ContextWrapper, getWrapperContainer
+ from zope.app.context import ContextWrapper
+ from zope.context import getWrapperContainer
from zope.app.traversing.adapters import Traverser
from zope.publisher.browser import TestRequest
@@ -63,7 +64,7 @@
traverser = Traverser(c2c1)
v = traverser.traverse('++skin++ZopeTop', request=TestRequest())
self.assertEqual(v, c2)
- self.failUnless(getWrapperContainer(v) is c2c1)
+ self.failUnless(getWrapperContainer(v) is c1)
def test_suite():
=== Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py 1.7 => 1.7.10.1 ===
--- Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py:1.7 Thu May 1 15:35:38 2003
+++ Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py Sun Jun 22 10:23:34 2003
@@ -19,15 +19,19 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.component.adapter import provideAdapter
from zope.component import getAdapter
+from zope.interface import implements
from zope.app.interfaces.traversing import IContainmentRoot
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.traversing.adapters import WrapperPhysicallyLocatable
from zope.app.traversing.adapters import RootPhysicallyLocatable
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
-class Root: __implements__ = IContainmentRoot
-class C: pass
+class Root:
+ implements(IContainmentRoot)
+
+class C:
+ pass
class Test(PlacelessSetup, TestCase):
@@ -44,10 +48,12 @@
adapter = getAdapter(f3, IPhysicallyLocatable)
self.assertEqual(adapter.getPath(), '/f1/f2/f3')
+ self.assertEqual(adapter.getName(), 'f3')
self.assertEqual(adapter.getRoot(), root)
adapter = getAdapter(C(), IPhysicallyLocatable)
self.assertRaises(TypeError, adapter.getPath)
+ self.assertRaises(TypeError, adapter.getName)
self.assertRaises(TypeError, adapter.getRoot)
def testWSideEffectDataInFront(self):
@@ -56,8 +62,9 @@
RootPhysicallyLocatable)
root = Root()
- root = ContextWrapper(root, root, name='.',
- side_effect_name="++skin++ZopeTop")
+ root = ContextWrapper(root, None,
+ side_effect_names=("++skin++ZopeTop", ),
+ )
f1 = ContextWrapper(C(), root, name='f1')
f2 = ContextWrapper(C(), f1, name='f2')
f3 = ContextWrapper(C(), f2, name='f3')
@@ -65,10 +72,12 @@
adapter = getAdapter(f3, IPhysicallyLocatable)
self.assertEqual(adapter.getPath(), '/f1/f2/f3')
+ self.assertEqual(adapter.getName(), 'f3')
self.assertEqual(adapter.getRoot(), root)
adapter = getAdapter(C(), IPhysicallyLocatable)
self.assertRaises(TypeError, adapter.getPath)
+ self.assertRaises(TypeError, adapter.getName)
self.assertRaises(TypeError, adapter.getRoot)
def testWSideEffectDataInMiddle(self):
@@ -78,19 +87,22 @@
root = Root()
c = C()
- f1 = ContextWrapper(c, root, name='f1')
- f1 = ContextWrapper(c, f1, name='.',
- side_effect_name="++skin++ZopeTop")
+ f1 = ContextWrapper(c, root,
+ name='f1',
+ side_effect_names=("++skin++ZopeTop", ),
+ )
f2 = ContextWrapper(C(), f1, name='f2')
f3 = ContextWrapper(C(), f2, name='f3')
adapter = getAdapter(f3, IPhysicallyLocatable)
self.assertEqual(adapter.getPath(), '/f1/f2/f3')
+ self.assertEqual(adapter.getName(), 'f3')
self.assertEqual(adapter.getRoot(), root)
adapter = getAdapter(C(), IPhysicallyLocatable)
self.assertRaises(TypeError, adapter.getPath)
+ self.assertRaises(TypeError, adapter.getName)
self.assertRaises(TypeError, adapter.getRoot)
def test_suite():
=== Zope3/src/zope/app/traversing/tests/test_presentation.py 1.4 => 1.4.10.1 ===
--- Zope3/src/zope/app/traversing/tests/test_presentation.py:1.4 Thu May 1 15:35:38 2003
+++ Zope3/src/zope/app/traversing/tests/test_presentation.py Sun Jun 22 10:23:34 2003
@@ -22,20 +22,25 @@
from zope.component.view import provideView
from zope.component.resource import provideResource
from zope.app.traversing.namespace import view, resource
-from zope.interface import Interface
+from zope.interface import Interface, implements
-class IContent(Interface): pass
-class IPresentationType(Interface): pass
+class IContent(Interface):
+ pass
-class Content: __implements__ = IContent
+class IPresentationType(Interface):
+ pass
+
+class Content:
+ implements(IContent)
class Resource:
+ implements(IPresentationType)
- def __init__(self, request): pass
- __implements__ = IPresentationType
+ def __init__(self, request):
+ pass
class View:
- __implements__ = IPresentationType
+ implements(IPresentationType)
def __init__(self, content, request):
self.content = content
=== Zope3/src/zope/app/traversing/tests/test_traverser.py 1.9 => 1.9.12.1 ===
--- Zope3/src/zope/app/traversing/tests/test_traverser.py:1.9 Fri Apr 18 18:12:29 2003
+++ Zope3/src/zope/app/traversing/tests/test_traverser.py Sun Jun 22 10:23:34 2003
@@ -20,7 +20,7 @@
from zope.interface import directlyProvides
from zope.interface.verify import verifyClass
-from zope.interface.implements import instancesOfObjectImplements
+from zope.interface import implementedBy
from zope.app.interfaces.traversing import ITraverser, ITraversable
from zope.app.traversing.adapters import Traverser, DefaultTraversable
@@ -30,7 +30,7 @@
from zope.app.traversing.adapters import WrapperPhysicallyLocatable
from zope.app.traversing.adapters import RootPhysicallyLocatable
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
from zope.exceptions import NotFoundError, Unauthorized
from zope.component import getService
from zope.app.services.servicenames import Adapters
@@ -58,7 +58,7 @@
self.failUnless(ITraverser.isImplementedBy(self.tr))
def testVerifyInterfaces(self):
- for interface in instancesOfObjectImplements(Traverser):
+ for interface in implementedBy(Traverser):
verifyClass(interface, Traverser)
class UnrestrictedNoTraverseTests(unittest.TestCase):
@@ -201,7 +201,7 @@
self.failUnless(ITraversable.isImplementedBy(DefaultTraversable(None)))
def testVerifyInterfaces(self):
- for interface in instancesOfObjectImplements(DefaultTraversable):
+ for interface in implementedBy(DefaultTraversable):
verifyClass(interface, DefaultTraversable)
def testAttributeTraverse(self):
=== Removed File Zope3/src/zope/app/traversing/tests/test_objectname.py ===