[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests - placelesssetup.py:1.2.26.3 test_icontainer.py:1.5.10.1 test_objectcopier.py:1.9.24.1 test_objectmover.py:1.6.24.1 test_add.py:NONE test_remove.py:NONE

Jim Fulton jim at zope.com
Fri Sep 12 15:15:52 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	placelesssetup.py test_icontainer.py test_objectcopier.py 
	test_objectmover.py 
Removed Files:
      Tag: parentgeddon-branch
	test_add.py test_remove.py 
Log Message:
Can't have the tests passing, can we?

=== Zope3/src/zope/app/container/tests/placelesssetup.py 1.2.26.2 => 1.2.26.3 ===
--- Zope3/src/zope/app/container/tests/placelesssetup.py:1.2.26.2	Mon Sep  8 18:36:52 2003
+++ Zope3/src/zope/app/container/tests/placelesssetup.py	Fri Sep 12 15:15:21 2003
@@ -17,12 +17,10 @@
 """
 from zope.component.adapter import provideAdapter
 from zope.app.interfaces.container import IWriteContainer
-from zope.app.interfaces.container import IAddTarget, IRemoveSource
-from zope.app.container.add import AddTarget
-from zope.app.container.remove import RemoveSource
+from zope.app.interfaces.container import INameChooser
+from zope.app.container.contained import NameChooser
 
 class PlacelessSetup:
 
     def setUp(self):
-        provideAdapter(IWriteContainer, IAddTarget, AddTarget)
-        provideAdapter(IWriteContainer, IRemoveSource, RemoveSource)
+        provideAdapter(IWriteContainer, INameChooser, NameChooser)


=== Zope3/src/zope/app/container/tests/test_icontainer.py 1.5 => 1.5.10.1 ===
--- Zope3/src/zope/app/container/tests/test_icontainer.py:1.5	Mon Jul 28 07:45:24 2003
+++ Zope3/src/zope/app/container/tests/test_icontainer.py	Fri Sep 12 15:15:21 2003
@@ -19,13 +19,14 @@
 from unittest import TestCase, main, makeSuite
 from zope.app.interfaces.container import IContainer
 from zope.interface.verify import verifyObject
+from zope.app.event.tests.placelesssetup import PlacelessSetup
 
 
 def DefaultTestData():
         return [('3', '0'), ('2', '1'), ('4', '2'), ('6', '3'), ('0', '4'),
                 ('5', '5'), ('1', '6'), ('8', '7'), ('7', '8'), ('9', '9')]
 
-class BaseTestIContainer:
+class BaseTestIContainer(PlacelessSetup):
     """Base test cases for containers.
 
     Subclasses must define a makeTestObject that takes no
@@ -40,7 +41,7 @@
         self.__container = container = self.makeTestObject()
         self.__data = data = self.makeTestData()
         for k, v in data:
-            container.setObject(k, v)
+            container[k] = v
         return container, data
 
     ############################################################
@@ -164,21 +165,21 @@
         data = self.makeTestData()
         value = data[1][1]
         for name in self.getBadKeyTypes():
-            self.assertRaises(TypeError, folder.setObject, name, value)
+            self.assertRaises(TypeError, folder.__setitem__, name, value)
 
     def testOneItem(self):
         folder = self.makeTestObject()
         data = self.makeTestData()
 
         foo = data[0][1]
-        name = folder.setObject('foo', foo)
+        folder['foo'] = foo
 
         self.assertEquals(len(folder.keys()), 1)
-        self.assertEquals(folder.keys()[0], name)
+        self.assertEquals(folder.keys()[0], 'foo')
         self.assertEquals(len(folder.values()), 1)
         self.assertEquals(folder.values()[0], foo)
         self.assertEquals(len(folder.items()), 1)
-        self.assertEquals(folder.items()[0], (name, foo))
+        self.assertEquals(folder.items()[0], ('foo', foo))
         self.assertEquals(len(folder), 1)
 
         self.failUnless(name in folder)
@@ -192,7 +193,9 @@
         self.assertRaises(KeyError, folder.__getitem__, data[6][0])
 
         foo2 = data[1][1]
-        name2 = folder.setObject('foo2', foo2)
+        
+        name2 = 'foo2'
+        folder[name2] = foo2
 
         self.assertEquals(len(folder.keys()), 2)
         self.assertEquals(not not name2 in folder.keys(), True)
@@ -219,10 +222,14 @@
         folder = self.makeTestObject()
         data = self.makeTestData()
         objects = [ data[i][1] for i in range(4) ]
-        name0 = folder.setObject('foo', objects[0])
-        name1 = folder.setObject('bar', objects[1])
-        name2 = folder.setObject('baz', objects[2])
-        name3 = folder.setObject('bam', objects[3])
+        name0 = 'foo'
+        name1 = 'bar'
+        name2 = 'baz'
+        name3 = 'bam'
+        folder['foo'] = objects[0]
+        folder['bar'] = objects[1]
+        folder['baz'] = objects[2]
+        folder['bam'] = objects[3]
 
         self.assertEquals(len(folder.keys()), len(objects))
         self.failUnless(name0 in folder.keys())


=== Zope3/src/zope/app/container/tests/test_objectcopier.py 1.9 => 1.9.24.1 ===
--- Zope3/src/zope/app/container/tests/test_objectcopier.py:1.9	Fri Jun 13 13:41:14 2003
+++ Zope3/src/zope/app/container/tests/test_objectcopier.py	Fri Sep 12 15:15:21 2003
@@ -23,16 +23,7 @@
 from zope.component import getAdapter, ComponentLookupError
 from zope.component.adapter import provideAdapter
 from zope.app.interfaces.copypastemove import IObjectCopier
-from zope.app.interfaces.copypastemove import INoChildrenObjectCopier
-from zope.app.interfaces.container import CopyException
 from zope.app.interfaces.container import IContainer
-from zope.app.interfaces.container import IPasteTarget
-from zope.app.interfaces.container import ICopySource, INoChildrenCopySource
-from zope.app.interfaces.container import IPasteNamesChooser
-from zope.app.container.copypastemove import PasteTarget
-from zope.app.container.copypastemove import CopySource, NoChildrenCopySource
-from zope.app.container.copypastemove import PasteNamesChooser
-from zope.app.copypastemove import ObjectCopier, NoChildrenObjectCopier
 from zope.app.content.file import File
 from zope.app.container.sample import SampleContainer
 
@@ -49,7 +40,7 @@
     def test_copytosame(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
         copier.copyTo(container, 'file1')
@@ -59,7 +50,7 @@
     def test_copytosamewithnewname(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
         copier.copyTo(container, 'file2')
@@ -69,7 +60,7 @@
     def test_copytoother(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
@@ -80,7 +71,7 @@
     def test_copytootherwithnewname(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
@@ -91,9 +82,9 @@
     def test_copytootherwithnamecollision(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
-        target.setObject('file1', File())
+        target['file1'] = File()
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
         copier.copyTo(target, 'file1')
@@ -107,7 +98,7 @@
     def test_copyable(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
         self.failUnless(copier.copyable())
@@ -117,7 +108,7 @@
         #  object with the same id.
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         copier = getAdapter(file, IObjectCopier)
         self.failUnless(copier.copyableTo(container, 'file1'))
@@ -162,65 +153,9 @@
         copier.copyTo(target)
         self.failUnless('folder1' in target)
 
-class NoChildrenObjectCopierTest(PlacefulSetup, TestCase):
-
-    def setUp(self):
-        PlacefulSetup.setUp(self)
-        PlacefulSetup.buildFolders(self)
-        provideAdapter(None, IObjectCopier, ObjectCopier)
-        provideAdapter(IContainer, INoChildrenObjectCopier,
-                       NoChildrenObjectCopier)
-        provideAdapter(IContainer, IPasteTarget, PasteTarget)
-        provideAdapter(IContainer, ICopySource, CopySource)
-        provideAdapter(IContainer, INoChildrenCopySource, NoChildrenCopySource)
-        provideAdapter(IContainer, IPasteNamesChooser, PasteNamesChooser)
-
-    def test_copytosame(self):
-        root = self.rootFolder
-        container = traverse(root, 'folder1')
-        folder1 = traverse(root, 'folder1')
-        copier = getAdapter(folder1, INoChildrenObjectCopier)
-        copier.copyTo(container, 'new_folder1')
-        new_folder1 = traverse(container, 'new_folder1')
-        self.assertEquals(len(new_folder1.keys()), 0)
-
-    def test_notavailforfile(self):
-        root = self.rootFolder
-        container = traverse(root, 'folder1')
-        container.setObject('file1', File())
-        file = traverse(root, 'folder1/file1')
-        self.assertRaises(ComponentLookupError,
-                          getAdapter, file, INoChildrenObjectCopier)
-
-    def test_copytoother(self):
-        root = self.rootFolder
-        container = traverse(root, 'folder1')
-        target = traverse(root, 'folder2')
-        folder1_1 = traverse(root, 'folder1/folder1_1')
-        copier = getAdapter(folder1_1, INoChildrenObjectCopier)
-        copier.copyTo(target, 'folder1_1')
-        new_folder1_1 = traverse(root, 'folder2/folder1_1')
-        self.assertEquals(len(new_folder1_1.keys()), 0)
-
-    def test_notavailforfile(self):
-        root = self.rootFolder
-        container = traverse(root, 'folder1')
-        container.setObject('file1', File())
-        file = traverse(root, 'folder1/file1')
-        self.assertRaises(ComponentLookupError,
-                          getAdapter, file, INoChildrenObjectCopier)
-
-    def test_doesntimplementclonewithoutchildren(self):
-        root = self.rootFolder
-        root.setObject('sample', SampleContainer())
-        folder = traverse(root, 'sample')
-        copier = getAdapter(folder, INoChildrenObjectCopier)
-        self.assertRaises(CopyException, copier.copyTo, root, 'new_sample')
-
 def test_suite():
     return TestSuite((
         makeSuite(ObjectCopierTest),
-        makeSuite(NoChildrenObjectCopierTest),
         ))
 
 if __name__=='__main__':


=== Zope3/src/zope/app/container/tests/test_objectmover.py 1.6 => 1.6.24.1 ===
--- Zope3/src/zope/app/container/tests/test_objectmover.py:1.6	Fri Jun 13 13:41:14 2003
+++ Zope3/src/zope/app/container/tests/test_objectmover.py	Fri Sep 12 15:15:21 2003
@@ -24,12 +24,6 @@
 from zope.component.adapter import provideAdapter
 from zope.app.interfaces.copypastemove import IObjectMover
 from zope.app.interfaces.content.folder import IFolder
-from zope.app.interfaces.container import IPasteTarget
-from zope.app.interfaces.container import IMoveSource
-from zope.app.interfaces.container import IPasteNamesChooser
-from zope.app.container.copypastemove import PasteTarget
-from zope.app.container.copypastemove import MoveSource
-from zope.app.container.copypastemove import PasteNamesChooser
 from zope.app.copypastemove import ObjectMover
 from zope.app.content.file import File
 
@@ -39,14 +33,11 @@
         PlacefulSetup.setUp(self)
         PlacefulSetup.buildFolders(self)
         provideAdapter(None, IObjectMover, ObjectMover)
-        provideAdapter(IFolder, IPasteTarget, PasteTarget)
-        provideAdapter(IFolder, IMoveSource, MoveSource)
-        provideAdapter(IFolder, IPasteNamesChooser, PasteNamesChooser)
  
     def test_movetosame(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
         mover.moveTo(container, 'file1')
@@ -55,7 +46,7 @@
     def test_movetosamewithnewname(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
         mover.moveTo(container, 'file2')
@@ -65,7 +56,7 @@
     def test_movetoother(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
@@ -76,7 +67,7 @@
     def test_movetootherwithnewname(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
@@ -87,9 +78,9 @@
     def test_movetootherwithnamecollision(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         target = traverse(root, 'folder2')
-        target.setObject('file1', File())
+        target['file1'] = File()
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
         mover.moveTo(target, 'file1')
@@ -100,7 +91,7 @@
     def test_moveable(self):
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
         self.failUnless(mover.moveable())
@@ -110,7 +101,7 @@
         #  object with the same id.
         root = self.rootFolder
         container = traverse(root, 'folder1')
-        container.setObject('file1', File())
+        container['file1'] = File()
         file = traverse(root, 'folder1/file1')
         mover = getAdapter(file, IObjectMover)
         self.failUnless(mover.moveableTo(container, 'file1'))

=== Removed File Zope3/src/zope/app/container/tests/test_add.py ===

=== Removed File Zope3/src/zope/app/container/tests/test_remove.py ===




More information about the Zope3-Checkins mailing list