[Zope-Checkins] CVS: Zope/lib/python/OFS/tests -
testOrderSupport.py:1.2.2.1 testOrderedFolder.py:1.2.2.1
Yvo Schubbe
y.2004_ at wcm-solutions.de
Fri Apr 9 08:24:37 EDT 2004
Update of /cvs-repository/Zope/lib/python/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv22275/lib/python/OFS/tests
Modified Files:
Tag: Zope-2_7-branch
testOrderSupport.py testOrderedFolder.py
Log Message:
- added optional 'subset_ids' argument to move methods
=== Zope/lib/python/OFS/tests/testOrderSupport.py 1.2 => 1.2.2.1 ===
--- Zope/lib/python/OFS/tests/testOrderSupport.py:1.2 Thu Jun 12 06:21:00 2003
+++ Zope/lib/python/OFS/tests/testOrderSupport.py Fri Apr 9 08:24:06 2004
@@ -1,5 +1,6 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
Zope.startup()
from Interface.Verify import verifyClass
@@ -40,100 +41,106 @@
f.o4 = DummyObject('o4', 'mt2')
return f
- def _doCanonTestA(self, methodname, table):
- for arg1, order, rval in table:
+ def _doCanonTest(self, methodname, table):
+ for args, order, rval in table:
f = self._makeOne()
method = getattr(f, methodname)
if rval == 'ValueError':
- self.failUnlessRaises( ValueError, method, arg1 )
+ self.failUnlessRaises( ValueError, method, *args )
else:
- self.failUnlessEqual( method(arg1), rval )
- self.failUnlessEqual( f.objectIds(), order )
-
- def _doCanonTestB(self, methodname, table):
- for arg1, arg2, order, rval in table:
- f = self._makeOne()
- method = getattr(f, methodname)
- if rval == 'ValueError':
- self.failUnlessRaises( ValueError, method, arg1, arg2 )
- else:
- self.failUnlessEqual( method(arg1, arg2), rval )
+ self.failUnlessEqual( method(*args), rval )
self.failUnlessEqual( f.objectIds(), order )
def test_moveObjectsUp(self):
- self._doCanonTestB( 'moveObjectsUp',
- ( ( 'o4', 1, ['o1', 'o2', 'o4', 'o3'], 1 )
- , ( 'o4', 2, ['o1', 'o4', 'o2', 'o3'], 1 )
- , ( ('o1', 'o3'), 1, ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o1', 'o3'), 9, ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o2', 'o3'), 1, ['o2', 'o3', 'o1', 'o4'], 2 )
- , ( ('n2', 'o3'), 1, ['o1', 'o2', 'o3', 'o4'], 'ValueError')
- , ( ('o3', 'o1'), 1, ['o1', 'o3', 'o2', 'o4'], 1 )
+ self._doCanonTest( 'moveObjectsUp',
+ ( ( ( 'o4', 1 ), ['o1', 'o2', 'o4', 'o3'], 1 )
+ , ( ( 'o4', 2 ), ['o1', 'o4', 'o2', 'o3'], 1 )
+ , ( ( ('o1', 'o3'), 1 ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o1', 'o3'), 9 ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o2', 'o3'), 1 ), ['o2', 'o3', 'o1', 'o4'], 2 )
+ , ( ( ('o2', 'o3'), 1, ('o1', 'o2', 'o3', 'o4') ),
+ ['o2', 'o3', 'o1', 'o4'], 2 )
+ , ( ( ('o2', 'o3'), 1, ('o2', 'o3', 'o4') ),
+ ['o1', 'o2', 'o3', 'o4'], 0 )
+ , ( ( ('n2', 'o3'), 1 ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ , ( ( ('o3', 'o1'), 1 ), ['o1', 'o3', 'o2', 'o4'], 1 )
)
)
def test_moveObjectsDown(self):
- self._doCanonTestB( 'moveObjectsDown',
- ( ( 'o1', 1, ['o2', 'o1', 'o3', 'o4'], 1 )
- , ( 'o1', 2, ['o2', 'o3', 'o1', 'o4'], 1 )
- , ( ('o2', 'o4'), 1, ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o2', 'o4'), 9, ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o2', 'o3'), 1, ['o1', 'o4', 'o2', 'o3'], 2 )
- , ( ('n2', 'o3'), 1, ['o1', 'o2', 'o3', 'o4'], 'ValueError')
- , ( ('o4', 'o2'), 1, ['o1', 'o3', 'o2', 'o4'], 1 )
+ self._doCanonTest( 'moveObjectsDown',
+ ( ( ( 'o1', 1 ), ['o2', 'o1', 'o3', 'o4'], 1 )
+ , ( ( 'o1', 2 ), ['o2', 'o3', 'o1', 'o4'], 1 )
+ , ( ( ('o2', 'o4'), 1 ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o2', 'o4'), 9 ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o2', 'o3'), 1 ), ['o1', 'o4', 'o2', 'o3'], 2 )
+ , ( ( ('o2', 'o3'), 1, ('o1', 'o2', 'o3', 'o4') ),
+ ['o1', 'o4', 'o2', 'o3'], 2 )
+ , ( ( ('o2', 'o3'), 1, ('o1', 'o2', 'o3') ),
+ ['o1', 'o2', 'o3', 'o4'], 0 )
+ , ( ( ('n2', 'o3'), 1 ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ , ( ( ('o4', 'o2'), 1 ), ['o1', 'o3', 'o2', 'o4'], 1 )
)
)
def test_moveObjectsToTop(self):
- self._doCanonTestA( 'moveObjectsToTop',
- ( ( 'o4', ['o4', 'o1', 'o2', 'o3'], 1 )
- , ( ('o1', 'o3'), ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o2', 'o3'), ['o2', 'o3', 'o1', 'o4'], 2 )
- , ( ('n2', 'o3'), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
- , ( ('o3', 'o1'), ['o3', 'o1', 'o2', 'o4'], 1 )
+ self._doCanonTest( 'moveObjectsToTop',
+ ( ( ( 'o4', ), ['o4', 'o1', 'o2', 'o3'], 1 )
+ , ( ( ('o1', 'o3'), ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o2', 'o3'), ), ['o2', 'o3', 'o1', 'o4'], 2 )
+ , ( ( ('o2', 'o3'), ('o1', 'o2', 'o3', 'o4') ),
+ ['o2', 'o3', 'o1', 'o4'], 2 )
+ , ( ( ('o2', 'o3'), ('o2', 'o3', 'o4') ),
+ ['o1', 'o2', 'o3', 'o4'], 0 )
+ , ( ( ('n2', 'o3'), ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ , ( ( ('o3', 'o1'), ), ['o3', 'o1', 'o2', 'o4'], 1 )
)
)
def test_moveObjectsToBottom(self):
- self._doCanonTestA( 'moveObjectsToBottom',
- ( ( 'o1', ['o2', 'o3', 'o4', 'o1'], 1 )
- , ( ('o2', 'o4'), ['o1', 'o3', 'o2', 'o4'], 1 )
- , ( ('o2', 'o3'), ['o1', 'o4', 'o2', 'o3'], 2 )
- , ( ('n2', 'o3'), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
- , ( ('o4', 'o2'), ['o1', 'o3', 'o4', 'o2'], 1 )
+ self._doCanonTest( 'moveObjectsToBottom',
+ ( ( ( 'o1', ), ['o2', 'o3', 'o4', 'o1'], 1 )
+ , ( ( ('o2', 'o4'), ), ['o1', 'o3', 'o2', 'o4'], 1 )
+ , ( ( ('o2', 'o3'), ), ['o1', 'o4', 'o2', 'o3'], 2 )
+ , ( ( ('o2', 'o3'), ('o1', 'o2', 'o3', 'o4') ),
+ ['o1', 'o4', 'o2', 'o3'], 2 )
+ , ( ( ('o2', 'o3'), ('o1', 'o2', 'o3') ),
+ ['o1', 'o2', 'o3', 'o4'], 0 )
+ , ( ( ('n2', 'o3'), ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ , ( ( ('o4', 'o2'), ), ['o1', 'o3', 'o4', 'o2'], 1 )
)
)
def test_orderObjects(self):
- self._doCanonTestB( 'orderObjects',
- ( ( 'id', 'id', ['o4', 'o3', 'o2', 'o1'], 3)
- , ( 'meta_type', '', ['o1', 'o3', 'o2', 'o4'], 1)
- , ( 'meta_type', 'n', ['o4', 'o2', 'o3', 'o1'], 3)
- , ( 'position', 0, ['o1', 'o2', 'o3', 'o4'], 0)
- , ( 'position', 1, ['o4', 'o3', 'o2', 'o1'], 3)
+ self._doCanonTest( 'orderObjects',
+ ( ( ( 'id', 'id' ), ['o4', 'o3', 'o2', 'o1'], 3)
+ , ( ( 'meta_type', '' ), ['o1', 'o3', 'o2', 'o4'], 1)
+ , ( ( 'meta_type', 'n' ), ['o4', 'o2', 'o3', 'o1'], 3)
+ , ( ( 'position', 0 ), ['o1', 'o2', 'o3', 'o4'], 0)
+ , ( ( 'position', 1 ), ['o4', 'o3', 'o2', 'o1'], 3)
)
)
def test_getObjectPosition(self):
- self._doCanonTestA( 'getObjectPosition',
- ( ( 'o2', ['o1', 'o2', 'o3', 'o4'], 1)
- , ( 'o4', ['o1', 'o2', 'o3', 'o4'], 3)
- , ( 'n2', ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ self._doCanonTest( 'getObjectPosition',
+ ( ( ( 'o2', ), ['o1', 'o2', 'o3', 'o4'], 1)
+ , ( ( 'o4', ), ['o1', 'o2', 'o3', 'o4'], 3)
+ , ( ( 'n2', ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
)
)
def test_moveObjectToPosition(self):
- self._doCanonTestB( 'moveObjectToPosition',
- ( ( 'o2', 2, ['o1', 'o3', 'o2', 'o4'], 1)
- , ( 'o4', 2, ['o1', 'o2', 'o4', 'o3'], 1)
- , ( 'n2', 2, ['o1', 'o2', 'o3', 'o4'], 'ValueError')
+ self._doCanonTest( 'moveObjectToPosition',
+ ( ( ( 'o2', 2 ), ['o1', 'o3', 'o2', 'o4'], 1)
+ , ( ( 'o4', 2 ), ['o1', 'o2', 'o4', 'o3'], 1)
+ , ( ( 'n2', 2 ), ['o1', 'o2', 'o3', 'o4'], 'ValueError')
)
)
def test_manage_renameObject(self):
- self._doCanonTestB( 'manage_renameObject',
- ( ( 'o2', 'n2', ['o1', 'n2', 'o3', 'o4'], None )
- , ( 'o3', 'n3', ['o1', 'o2', 'n3', 'o4'], None )
+ self._doCanonTest( 'manage_renameObject',
+ ( ( ( 'o2', 'n2' ), ['o1', 'n2', 'o3', 'o4'], None )
+ , ( ( 'o3', 'n3' ), ['o1', 'o2', 'n3', 'o4'], None )
)
)
=== Zope/lib/python/OFS/tests/testOrderedFolder.py 1.2 => 1.2.2.1 ===
--- Zope/lib/python/OFS/tests/testOrderedFolder.py:1.2 Thu Jun 12 06:21:00 2003
+++ Zope/lib/python/OFS/tests/testOrderedFolder.py Fri Apr 9 08:24:06 2004
@@ -1,5 +1,6 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
Zope.startup()
from Interface.Verify import verifyClass
More information about the Zope-Checkins
mailing list