[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests -
test_objectcopier.py:1.15 test_objectmover.py:1.12
Jim Fulton
jim at zope.com
Sat Mar 6 11:50:49 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/container/tests
In directory cvs.zope.org:/tmp/cvs-serv11249/src/zope/app/container/tests
Modified Files:
test_objectcopier.py test_objectmover.py
Log Message:
Converted most getAdapter calls to use interface calls instead.
=== Zope3/src/zope/app/container/tests/test_objectcopier.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/container/tests/test_objectcopier.py:1.14 Wed Mar 3 05:52:03 2004
+++ Zope3/src/zope/app/container/tests/test_objectcopier.py Sat Mar 6 11:50:19 2004
@@ -20,7 +20,6 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app.traversing import traverse
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.component import getAdapter
from zope.app.tests import ztapi
from zope.app.copypastemove.interfaces import IObjectCopier
from zope.app.copypastemove import ObjectCopier
@@ -40,7 +39,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
copier.copyTo(container, 'file1')
self.failUnless('file1' in container)
self.failUnless('file1-2' in container)
@@ -50,7 +49,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
copier.copyTo(container, 'file2')
self.failUnless('file1' in container)
self.failUnless('file2' in container)
@@ -61,7 +60,7 @@
container['file1'] = File()
target = traverse(root, 'folder2')
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
copier.copyTo(target, 'file1')
self.failUnless('file1' in container)
self.failUnless('file1' in target)
@@ -72,7 +71,7 @@
container['file1'] = File()
target = traverse(root, 'folder2')
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
copier.copyTo(target, 'file2')
self.failUnless('file1' in container)
self.failUnless('file2' in target)
@@ -84,7 +83,7 @@
target = traverse(root, 'folder2')
target['file1'] = File()
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
copier.copyTo(target, 'file1')
# we do it twice, just to test auto-name generation
copier.copyTo(target, 'file1')
@@ -98,7 +97,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
self.failUnless(copier.copyable())
def test_copyableTo(self):
@@ -108,14 +107,14 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- copier = getAdapter(file, IObjectCopier)
+ copier = IObjectCopier(file)
self.failUnless(copier.copyableTo(container, 'file1'))
def test_copyfoldertosibling(self):
root = self.rootFolder
target = traverse(root, '/folder2')
source = traverse(root, '/folder1/folder1_1')
- copier = getAdapter(source, IObjectCopier)
+ copier = IObjectCopier(source)
copier.copyTo(target)
self.failUnless('folder1_1' in target)
@@ -123,7 +122,7 @@
root = self.rootFolder
target = traverse(root, '/folder1')
source = traverse(root, '/folder1/folder1_1')
- copier = getAdapter(source, IObjectCopier)
+ copier = IObjectCopier(source)
copier.copyTo(target)
self.failUnless('folder1_1' in target)
@@ -131,7 +130,7 @@
root = self.rootFolder
target = traverse(root, '/folder1/folder1_1')
source = traverse(root, '/folder1/folder1_1/folder1_1_1')
- copier = getAdapter(source, IObjectCopier)
+ copier = IObjectCopier(source)
copier.copyTo(target)
self.failUnless('folder1_1_1' in target)
@@ -139,7 +138,7 @@
root = self.rootFolder
target = traverse(root, '/folder2')
source = traverse(root, '/folder1')
- copier = getAdapter(source, IObjectCopier)
+ copier = IObjectCopier(source)
copier.copyTo(target)
self.failUnless('folder1' in target)
@@ -147,7 +146,7 @@
root = self.rootFolder
target = traverse(root, '/folder2/folder2_1/folder2_1_1')
source = traverse(root, '/folder1')
- copier = getAdapter(source, IObjectCopier)
+ copier = IObjectCopier(source)
copier.copyTo(target)
self.failUnless('folder1' in target)
=== Zope3/src/zope/app/container/tests/test_objectmover.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/container/tests/test_objectmover.py:1.11 Wed Mar 3 05:52:03 2004
+++ Zope3/src/zope/app/container/tests/test_objectmover.py Sat Mar 6 11:50:19 2004
@@ -16,7 +16,6 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.component import getAdapter
from zope.app.traversing import traverse
from zope.app.services.tests.placefulsetup import PlacefulSetup
@@ -40,7 +39,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
mover.moveTo(container, 'file1')
self.failUnless('file1' in container)
self.assertEquals(len(container), 3)
@@ -50,7 +49,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
mover.moveTo(container, 'file2')
self.failIf('file1' in container)
self.failUnless('file2' in container)
@@ -61,7 +60,7 @@
container['file1'] = File()
target = traverse(root, 'folder2')
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
mover.moveTo(target, 'file1')
self.failIf('file1' in container)
self.failUnless('file1' in target)
@@ -72,7 +71,7 @@
container['file1'] = File()
target = traverse(root, 'folder2')
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
mover.moveTo(target, 'file2')
self.failIf('file1' in container)
self.failUnless('file2' in target)
@@ -84,7 +83,7 @@
target = traverse(root, 'folder2')
target['file1'] = File()
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
mover.moveTo(target, 'file1')
self.failIf('file1' in container)
self.failUnless('file1' in target)
@@ -95,7 +94,7 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
self.failUnless(mover.moveable())
def test_moveableTo(self):
@@ -105,14 +104,14 @@
container = traverse(root, 'folder1')
container['file1'] = File()
file = traverse(root, 'folder1/file1')
- mover = getAdapter(file, IObjectMover)
+ mover = IObjectMover(file)
self.failUnless(mover.moveableTo(container, 'file1'))
def test_movefoldertosibling(self):
root = self.rootFolder
target = traverse(root, '/folder2')
source = traverse(root, '/folder1/folder1_1')
- mover = getAdapter(source, IObjectMover)
+ mover = IObjectMover(source)
mover.moveTo(target)
self.failUnless('folder1_1' in target)
@@ -121,7 +120,7 @@
root = self.rootFolder
target = traverse(root, '/folder1')
source = traverse(root, '/folder1/folder1_1')
- mover = getAdapter(source, IObjectMover)
+ mover = IObjectMover(source)
mover.moveTo(target)
self.failUnless('folder1_1' in target)
self.assertEquals(len(target), 2)
@@ -131,7 +130,7 @@
root = self.rootFolder
target = traverse(root, '/folder1/folder1_1')
source = traverse(root, '/folder1/folder1_1/folder1_1_1')
- mover = getAdapter(source, IObjectMover)
+ mover = IObjectMover(source)
mover.moveTo(target)
self.failUnless('folder1_1_1' in target)
self.assertEquals(len(target), 2)
@@ -140,7 +139,7 @@
root = self.rootFolder
target = traverse(root, '/folder2')
source = traverse(root, '/folder1')
- mover = getAdapter(source, IObjectMover)
+ mover = IObjectMover(source)
mover.moveTo(target)
self.failUnless('folder1' in target)
@@ -148,7 +147,7 @@
root = self.rootFolder
target = traverse(root, '/folder2/folder2_1/folder2_1_1')
source = traverse(root, '/folder1')
- mover = getAdapter(source, IObjectMover)
+ mover = IObjectMover(source)
mover.moveTo(target)
self.failUnless('folder1' in target)
More information about the Zope3-Checkins
mailing list