[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests - test_conveniencefunctions.py:1.19 test_physicallocationadapters.py:1.12 test_objectname.py:NONE

Steve Alexander steve@cat-box.net
Fri, 13 Jun 2003 13:41:22 -0400


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

Modified Files:
	test_conveniencefunctions.py test_physicallocationadapters.py 
Removed Files:
	test_objectname.py 
Log Message:
Removed the @@object_name view, as used in some page templates, and
the ObjectName view and adapter also.
Extended IPhysicallyLocatable with a getName method.
Renamed the convenience function objectName to getName.

If you have page templates that use @@object_name, then you can replace it
with zope:name.



=== Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py 1.18 => 1.19 ===
--- Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py:1.18	Sun Jun  1 11:59:38 2003
+++ Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py	Fri Jun 13 13:41:21 2003
@@ -24,8 +24,7 @@
 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
@@ -73,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(
@@ -130,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
             )
 
@@ -214,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_physicallocationadapters.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py:1.11	Wed Jun  4 04:46:33 2003
+++ Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py	Fri Jun 13 13:41:21 2003
@@ -48,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):
@@ -70,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):
@@ -93,10 +97,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 test_suite():

=== Removed File Zope3/src/zope/app/traversing/tests/test_objectname.py ===