[Checkins] SVN: BTrees/branches/pure_python/ Move type-specific conflict tests into per-type testcase modules.
Tres Seaver
cvs-admin at zope.org
Mon Nov 12 22:48:41 UTC 2012
Log message for revision 128263:
Move type-specific conflict tests into per-type testcase modules.
Changed:
_U BTrees/branches/pure_python/
U BTrees/branches/pure_python/BTrees/tests/common.py
U BTrees/branches/pure_python/BTrees/tests/testConflict.py
U BTrees/branches/pure_python/BTrees/tests/test_IFBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_IIBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_IOBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_LFBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_LLBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_LOBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_OIBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_OLBTree.py
U BTrees/branches/pure_python/BTrees/tests/test_OOBTree.py
-=-
Modified: BTrees/branches/pure_python/BTrees/tests/common.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/common.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/common.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -1853,6 +1853,291 @@
self.assertEqual(list(fast), range(N))
+class ConflictTestBase(object):
+ # Tests common to all types: sets, buckets, and BTrees
+
+ storage = None
+
+ def tearDown(self):
+ import transaction
+ transaction.abort()
+ if self.storage is not None:
+ self.storage.close()
+ self.storage.cleanup()
+
+ def _makeOne(self):
+ return self._getTargetClass()()
+
+ def openDB(self):
+ import os
+ from ZODB.FileStorage import FileStorage
+ from ZODB.DB import DB
+ n = 'fs_tmp__%s' % os.getpid()
+ self.storage = FileStorage(n)
+ self.db = DB(self.storage)
+ return self.db
+
+
+def _test_merge(o1, o2, o3, expect, message='failed to merge', should_fail=0):
+ from BTrees.Interfaces import BTreesConflictError
+ s1 = o1.__getstate__()
+ s2 = o2.__getstate__()
+ s3 = o3.__getstate__()
+ expected = expect.__getstate__()
+ if expected is None:
+ expected = ((((),),),)
+
+ if should_fail:
+ try:
+ merged = o1._p_resolveConflict(s1, s2, s3)
+ except BTreesConflictError, err:
+ pass
+ else:
+ assert 0, message
+ else:
+ merged = o1._p_resolveConflict(s1, s2, s3)
+ assert merged == expected, message
+
+
+class MappingConflictTestBase(ConflictTestBase):
+ # Tests common to mappings (buckets, btrees).
+
+ def _deletefail(self):
+ t = self._makeOne()
+ del t[1]
+
+ def _setupConflict(self):
+
+ l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679,
+ 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191,
+ -4067]
+
+
+ e1=[(-1704, 0), (5420, 1), (-239, 2), (4024, 3), (-6984, 4)]
+ e2=[(7745, 0), (4868, 1), (-2548, 2), (-2711, 3), (-3154, 4)]
+
+
+ base = self._makeOne()
+ base.update([(i, i*i) for i in l[:20]])
+ b1=base.__class__(base)
+ b2=base.__class__(base)
+ bm=base.__class__(base)
+
+ items=base.items()
+
+ return base, b1, b2, bm, e1, e2, items
+
+ def testMergeDelete(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ del b1[items[1][0]]
+ del b2[items[5][0]]
+ del b1[items[-1][0]]
+ del b2[items[-2][0]]
+ del bm[items[1][0]]
+ del bm[items[5][0]]
+ del bm[items[-1][0]]
+ del bm[items[-2][0]]
+ _test_merge(base, b1, b2, bm, 'merge delete')
+
+ def testMergeDeleteAndUpdate(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ del b1[items[1][0]]
+ b2[items[5][0]]=1
+ del b1[items[-1][0]]
+ b2[items[-2][0]]=2
+ del bm[items[1][0]]
+ bm[items[5][0]]=1
+ del bm[items[-1][0]]
+ bm[items[-2][0]]=2
+ _test_merge(base, b1, b2, bm, 'merge update and delete')
+
+ def testMergeUpdate(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1[items[0][0]]=1
+ b2[items[5][0]]=2
+ b1[items[-1][0]]=3
+ b2[items[-2][0]]=4
+ bm[items[0][0]]=1
+ bm[items[5][0]]=2
+ bm[items[-1][0]]=3
+ bm[items[-2][0]]=4
+ _test_merge(base, b1, b2, bm, 'merge update')
+
+ def testFailMergeDelete(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ del b1[items[0][0]]
+ del b2[items[0][0]]
+ _test_merge(base, b1, b2, bm, 'merge conflicting delete',
+ should_fail=1)
+
+ def testFailMergeUpdate(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1[items[0][0]]=1
+ b2[items[0][0]]=2
+ _test_merge(base, b1, b2, bm, 'merge conflicting update',
+ should_fail=1)
+
+ def testFailMergeDeleteAndUpdate(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ del b1[items[0][0]]
+ b2[items[0][0]]=-9
+ _test_merge(base, b1, b2, bm, 'merge conflicting update and delete',
+ should_fail=1)
+
+ def testMergeInserts(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1[-99999]=-99999
+ b1[e1[0][0]]=e1[0][1]
+ b2[99999]=99999
+ b2[e1[2][0]]=e1[2][1]
+
+ bm[-99999]=-99999
+ bm[e1[0][0]]=e1[0][1]
+ bm[99999]=99999
+ bm[e1[2][0]]=e1[2][1]
+ _test_merge(base, b1, b2, bm, 'merge insert')
+
+ def testMergeInsertsFromEmpty(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ base.clear()
+ b1.clear()
+ b2.clear()
+ bm.clear()
+
+ b1.update(e1)
+ bm.update(e1)
+ b2.update(e2)
+ bm.update(e2)
+
+ _test_merge(base, b1, b2, bm, 'merge insert from empty')
+
+ def testFailMergeEmptyAndFill(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1.clear()
+ bm.clear()
+ b2.update(e2)
+ bm.update(e2)
+
+ _test_merge(base, b1, b2, bm, 'merge insert from empty', should_fail=1)
+
+ def testMergeEmpty(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1.clear()
+ bm.clear()
+
+ _test_merge(base, b1, b2, bm, 'empty one and not other', should_fail=1)
+
+ def testFailMergeInsert(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1[-99999]=-99999
+ b1[e1[0][0]]=e1[0][1]
+ b2[99999]=99999
+ b2[e1[0][0]]=e1[0][1]
+ _test_merge(base, b1, b2, bm, 'merge conflicting inserts',
+ should_fail=1)
+
+class SetConflictTestBase(ConflictTestBase):
+ "Set (as opposed to TreeSet) specific tests."
+
+ def _setupConflict(self):
+ l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679,
+ 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191,
+ -4067]
+
+ e1=[-1704, 5420, -239, 4024, -6984]
+ e2=[7745, 4868, -2548, -2711, -3154]
+
+
+ base = self._makeOne()
+ base.update(l)
+ b1=base.__class__(base)
+ b2=base.__class__(base)
+ bm=base.__class__(base)
+
+ items=base.keys()
+
+ return base, b1, b2, bm, e1, e2, items
+
+ def testMergeDelete(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1.remove(items[1])
+ b2.remove(items[5])
+ b1.remove(items[-1])
+ b2.remove(items[-2])
+ bm.remove(items[1])
+ bm.remove(items[5])
+ bm.remove(items[-1])
+ bm.remove(items[-2])
+ _test_merge(base, b1, b2, bm, 'merge delete')
+
+ def testFailMergeDelete(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1.remove(items[0])
+ b2.remove(items[0])
+ _test_merge(base, b1, b2, bm, 'merge conflicting delete',
+ should_fail=1)
+
+ def testMergeInserts(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1.insert(-99999)
+ b1.insert(e1[0])
+ b2.insert(99999)
+ b2.insert(e1[2])
+
+ bm.insert(-99999)
+ bm.insert(e1[0])
+ bm.insert(99999)
+ bm.insert(e1[2])
+ _test_merge(base, b1, b2, bm, 'merge insert')
+
+ def testMergeInsertsFromEmpty(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ base.clear()
+ b1.clear()
+ b2.clear()
+ bm.clear()
+
+ b1.update(e1)
+ bm.update(e1)
+ b2.update(e2)
+ bm.update(e2)
+
+ _test_merge(base, b1, b2, bm, 'merge insert from empty')
+
+ def testFailMergeEmptyAndFill(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1.clear()
+ bm.clear()
+ b2.update(e2)
+ bm.update(e2)
+
+ _test_merge(base, b1, b2, bm, 'merge insert from empty', should_fail=1)
+
+ def testMergeEmpty(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+
+ b1.clear()
+ bm.clear()
+
+ _test_merge(base, b1, b2, bm, 'empty one and not other', should_fail=1)
+
+ def testFailMergeInsert(self):
+ base, b1, b2, bm, e1, e2, items = self._setupConflict()
+ b1.insert(-99999)
+ b1.insert(e1[0])
+ b2.insert(99999)
+ b2.insert(e1[0])
+ _test_merge(base, b1, b2, bm, 'merge conflicting inserts',
+ should_fail=1)
+
+
## utility functions
def lsubtract(l1, l2):
Modified: BTrees/branches/pure_python/BTrees/tests/testConflict.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/testConflict.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/testConflict.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -13,498 +13,17 @@
##############################################################################
import unittest
+from .common import _skip_wo_ZODB
+from .common import ConflictTestBase
-def _skip_wo_ZODB(test_method): #pragma NO COVER
- try:
- import ZODB
- except ImportError: # skip this test if ZODB is not available
- def _dummy(*args):
- pass
- return _dummy
- else:
- return test_method
+class NastyConfictFunctionalTests(ConflictTestBase, unittest.TestCase):
+ # FUNCTESTS: Provoke various conflict scenarios using ZODB + transaction
-class Base:
- """ Tests common to all types: sets, buckets, and BTrees """
-
- storage = None
-
- def tearDown(self):
- import transaction
- transaction.abort()
- if self.storage is not None:
- self.storage.close()
- self.storage.cleanup()
-
- def _makeOne(self):
- return self._getTargetClass()()
-
- def openDB(self):
- import os
- from ZODB.FileStorage import FileStorage
- from ZODB.DB import DB
- n = 'fs_tmp__%s' % os.getpid()
- self.storage = FileStorage(n)
- self.db = DB(self.storage)
- return self.db
-
-class MappingBase(Base):
- """ Tests common to mappings (buckets, btrees) """
-
- def _deletefail(self):
- t = self._makeOne()
- del t[1]
-
- def _setupConflict(self):
-
- l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679,
- 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191,
- -4067]
-
-
- e1=[(-1704, 0), (5420, 1), (-239, 2), (4024, 3), (-6984, 4)]
- e2=[(7745, 0), (4868, 1), (-2548, 2), (-2711, 3), (-3154, 4)]
-
-
- base = self._makeOne()
- base.update([(i, i*i) for i in l[:20]])
- b1=base.__class__(base)
- b2=base.__class__(base)
- bm=base.__class__(base)
-
- items=base.items()
-
- return base, b1, b2, bm, e1, e2, items
-
- def testMergeDelete(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- del b1[items[1][0]]
- del b2[items[5][0]]
- del b1[items[-1][0]]
- del b2[items[-2][0]]
- del bm[items[1][0]]
- del bm[items[5][0]]
- del bm[items[-1][0]]
- del bm[items[-2][0]]
- _test_merge(base, b1, b2, bm, 'merge delete')
-
- def testMergeDeleteAndUpdate(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- del b1[items[1][0]]
- b2[items[5][0]]=1
- del b1[items[-1][0]]
- b2[items[-2][0]]=2
- del bm[items[1][0]]
- bm[items[5][0]]=1
- del bm[items[-1][0]]
- bm[items[-2][0]]=2
- _test_merge(base, b1, b2, bm, 'merge update and delete')
-
- def testMergeUpdate(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1[items[0][0]]=1
- b2[items[5][0]]=2
- b1[items[-1][0]]=3
- b2[items[-2][0]]=4
- bm[items[0][0]]=1
- bm[items[5][0]]=2
- bm[items[-1][0]]=3
- bm[items[-2][0]]=4
- _test_merge(base, b1, b2, bm, 'merge update')
-
- def testFailMergeDelete(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- del b1[items[0][0]]
- del b2[items[0][0]]
- _test_merge(base, b1, b2, bm, 'merge conflicting delete',
- should_fail=1)
-
- def testFailMergeUpdate(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1[items[0][0]]=1
- b2[items[0][0]]=2
- _test_merge(base, b1, b2, bm, 'merge conflicting update',
- should_fail=1)
-
- def testFailMergeDeleteAndUpdate(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- del b1[items[0][0]]
- b2[items[0][0]]=-9
- _test_merge(base, b1, b2, bm, 'merge conflicting update and delete',
- should_fail=1)
-
- def testMergeInserts(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1[-99999]=-99999
- b1[e1[0][0]]=e1[0][1]
- b2[99999]=99999
- b2[e1[2][0]]=e1[2][1]
-
- bm[-99999]=-99999
- bm[e1[0][0]]=e1[0][1]
- bm[99999]=99999
- bm[e1[2][0]]=e1[2][1]
- _test_merge(base, b1, b2, bm, 'merge insert')
-
- def testMergeInsertsFromEmpty(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- base.clear()
- b1.clear()
- b2.clear()
- bm.clear()
-
- b1.update(e1)
- bm.update(e1)
- b2.update(e2)
- bm.update(e2)
-
- _test_merge(base, b1, b2, bm, 'merge insert from empty')
-
- def testFailMergeEmptyAndFill(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1.clear()
- bm.clear()
- b2.update(e2)
- bm.update(e2)
-
- _test_merge(base, b1, b2, bm, 'merge insert from empty', should_fail=1)
-
- def testMergeEmpty(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1.clear()
- bm.clear()
-
- _test_merge(base, b1, b2, bm, 'empty one and not other', should_fail=1)
-
- def testFailMergeInsert(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1[-99999]=-99999
- b1[e1[0][0]]=e1[0][1]
- b2[99999]=99999
- b2[e1[0][0]]=e1[0][1]
- _test_merge(base, b1, b2, bm, 'merge conflicting inserts',
- should_fail=1)
-
-class SetTests(Base):
- "Set (as opposed to TreeSet) specific tests."
-
- def _setupConflict(self):
- l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679,
- 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191,
- -4067]
-
- e1=[-1704, 5420, -239, 4024, -6984]
- e2=[7745, 4868, -2548, -2711, -3154]
-
-
- base = self._makeOne()
- base.update(l)
- b1=base.__class__(base)
- b2=base.__class__(base)
- bm=base.__class__(base)
-
- items=base.keys()
-
- return base, b1, b2, bm, e1, e2, items
-
- def testMergeDelete(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1.remove(items[1])
- b2.remove(items[5])
- b1.remove(items[-1])
- b2.remove(items[-2])
- bm.remove(items[1])
- bm.remove(items[5])
- bm.remove(items[-1])
- bm.remove(items[-2])
- _test_merge(base, b1, b2, bm, 'merge delete')
-
- def testFailMergeDelete(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1.remove(items[0])
- b2.remove(items[0])
- _test_merge(base, b1, b2, bm, 'merge conflicting delete',
- should_fail=1)
-
- def testMergeInserts(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1.insert(-99999)
- b1.insert(e1[0])
- b2.insert(99999)
- b2.insert(e1[2])
-
- bm.insert(-99999)
- bm.insert(e1[0])
- bm.insert(99999)
- bm.insert(e1[2])
- _test_merge(base, b1, b2, bm, 'merge insert')
-
- def testMergeInsertsFromEmpty(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- base.clear()
- b1.clear()
- b2.clear()
- bm.clear()
-
- b1.update(e1)
- bm.update(e1)
- b2.update(e2)
- bm.update(e2)
-
- _test_merge(base, b1, b2, bm, 'merge insert from empty')
-
- def testFailMergeEmptyAndFill(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1.clear()
- bm.clear()
- b2.update(e2)
- bm.update(e2)
-
- _test_merge(base, b1, b2, bm, 'merge insert from empty', should_fail=1)
-
- def testMergeEmpty(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
-
- b1.clear()
- bm.clear()
-
- _test_merge(base, b1, b2, bm, 'empty one and not other', should_fail=1)
-
- def testFailMergeInsert(self):
- base, b1, b2, bm, e1, e2, items = self._setupConflict()
- b1.insert(-99999)
- b1.insert(e1[0])
- b2.insert(99999)
- b2.insert(e1[0])
- _test_merge(base, b1, b2, bm, 'merge conflicting inserts',
- should_fail=1)
-
-
-def _test_merge(o1, o2, o3, expect, message='failed to merge', should_fail=0):
- from BTrees.Interfaces import BTreesConflictError
- s1 = o1.__getstate__()
- s2 = o2.__getstate__()
- s3 = o3.__getstate__()
- expected = expect.__getstate__()
- if expected is None:
- expected = ((((),),),)
-
- if should_fail:
- try:
- merged = o1._p_resolveConflict(s1, s2, s3)
- except BTreesConflictError, err:
- pass
- else:
- assert 0, message
- else:
- merged = o1._p_resolveConflict(s1, s2, s3)
- assert merged == expected, message
-
-
-class OOBTreeTests(MappingBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OOBTree import OOBTree
return OOBTree
-class OOBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OOBTree import OOBucket
- return OOBucket
-
-class OOTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OOBTree import OOTreeSet
- return OOTreeSet
-
-class OOSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OOBTree import OOSet
- return OOSet
-
-
-class IIBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IIBTree import IIBTree
- return IIBTree
-
-class IIBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IIBTree import IIBucket
- return IIBucket
-
-class IITreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IIBTree import IITreeSet
- return IITreeSet
-
-class IISetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IIBTree import IISet
- return IISet
-
-
-class IOBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IOBTree import IOBTree
- return IOBTree
-
-class IOBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IOBTree import IOBucket
- return IOBucket
-
-class IOTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IOBTree import IOTreeSet
- return IOTreeSet
-
-class IOSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IOBTree import IOSet
- return IOSet
-
-
-class OIBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OIBTree import OIBTree
- return OIBTree
-
-class OIBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OIBTree import OIBucket
- return OIBucket
-
-class OITreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OIBTree import OITreeSet
- return OITreeSet
-
-class OISetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OIBTree import OISet
- return OISet
-
-
-class IFBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IFBTree import IFBTree
- return IFBTree
-
-class IFBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IFBTree import IFBucket
- return IFBucket
-
-class IFTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IFBTree import IFTreeSet
- return IFTreeSet
-
-class IFSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.IFBTree import IFSet
- return IFSet
-
-
-class LLBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LLBTree import LLBTree
- return LLBTree
-
-class LLBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LLBTree import LLBucket
- return LLBucket
-
-class LLTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LLBTree import LLTreeSet
- return LLTreeSet
-
-class LLSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LLBTree import LLSet
- return LLSet
-
-
-class LOBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LOBTree import LOBTree
- return LOBTree
-
-class LOBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LOBTree import LOBucket
- return LOBucket
-
-class LOTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LOBTree import LOTreeSet
- return LOTreeSet
-
-class LOSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LOBTree import LOSet
- return LOSet
-
-
-class OLBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OLBTree import OLBTree
- return OLBTree
-
-class OLBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OLBTree import OLBucket
- return OLBucket
-
-class OLTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OLBTree import OLTreeSet
- return OLTreeSet
-
-class OLSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.OLBTree import OLSet
- return OLSet
-
-
-class LFBTreeTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LFBTree import LFBTree
- return LFBTree
-
-class LFBucketTests(MappingBase, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LFBTree import LFBucket
- return LFBucket
-
-class LFTreeSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LFBTree import LFTreeSet
- return LFTreeSet
-
-class LFSetTests(SetTests, unittest.TestCase):
- def _getTargetClass(self):
- from BTrees.LFBTree import LFSet
- return LFSet
-
-
-class NastyConfictFunctionalTests(Base, unittest.TestCase):
- # Provoke various conflict scenarios using ZODB + transaction
-
- def _getTargetClass(self):
- from BTrees.OOBTree import OOBTree
- return OOBTree
-
@_skip_wo_ZODB
def testSimpleConflict(self):
# Invoke conflict resolution by committing a transaction and
@@ -1024,55 +543,7 @@
tm1.abort()
-
def test_suite():
- suite = unittest.TestSuite((
- unittest.makeSuite(OOBTreeTests),
- unittest.makeSuite(OOBucketTests),
- unittest.makeSuite(OOTreeSetTests),
- unittest.makeSuite(OOSetTests),
-
- unittest.makeSuite(IIBTreeTests),
- unittest.makeSuite(IIBucketTests),
- unittest.makeSuite(IITreeSetTests),
- unittest.makeSuite(IISetTests),
-
- unittest.makeSuite(IOBTreeTests),
- unittest.makeSuite(IOBucketTests),
- unittest.makeSuite(IOTreeSetTests),
- unittest.makeSuite(IOSetTests),
-
- unittest.makeSuite(OIBTreeTests),
- unittest.makeSuite(OIBucketTests),
- unittest.makeSuite(OITreeSetTests),
- unittest.makeSuite(OISetTests),
-
- unittest.makeSuite(IFBTreeTests),
- unittest.makeSuite(IFBucketTests),
- unittest.makeSuite(IFTreeSetTests),
- unittest.makeSuite(IFSetTests),
-
- unittest.makeSuite(LLBTreeTests),
- unittest.makeSuite(LLBucketTests),
- unittest.makeSuite(LLTreeSetTests),
- unittest.makeSuite(LLSetTests),
-
- unittest.makeSuite(LOBTreeTests),
- unittest.makeSuite(LOBucketTests),
- unittest.makeSuite(LOTreeSetTests),
- unittest.makeSuite(LOSetTests),
-
- unittest.makeSuite(OLBTreeTests),
- unittest.makeSuite(OLBucketTests),
- unittest.makeSuite(OLTreeSetTests),
- unittest.makeSuite(OLSetTests),
-
- unittest.makeSuite(LFBTreeTests),
- unittest.makeSuite(LFBucketTests),
- unittest.makeSuite(LFTreeSetTests),
- unittest.makeSuite(LFSetTests),
-
+ return unittest.TestSuite((
unittest.makeSuite(NastyConfictFunctionalTests),
))
-
- return suite
Modified: BTrees/branches/pure_python/BTrees/tests/test_IFBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_IFBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_IFBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -18,9 +18,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntKeys
from .common import makeBuilder
@@ -60,19 +62,7 @@
from BTrees.IFBTree import IFSet
return IFSet
-class IFModuleTest(ModuleTest, unittest.TestCase):
- prefix = 'IF'
-
- def _getModule(self):
- import BTrees
- return BTrees.IFBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerFloatBTreeModule
-
-
class IFBTreeTest(BTreeTests, unittest.TestCase):
def _makeOne(self):
@@ -161,6 +151,47 @@
from BTrees.IFBTree import IFSet
return IFSet, IFTreeSet, makeBuilder(IFBTree), makeBuilder(IFBucket)
+
+class IFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IFBTree import IFBTree
+ return IFBTree
+
+
+class IFBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IFBTree import IFBucket
+ return IFBucket
+
+
+class IFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IFBTree import IFTreeSet
+ return IFTreeSet
+
+
+class IFSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IFBTree import IFSet
+ return IFSet
+
+
+class IFModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'IF'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.IFBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerFloatBTreeModule
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(IFBTreeInternalKeyTest),
@@ -171,7 +202,10 @@
unittest.makeSuite(IFModuleTest),
unittest.makeSuite(IFBTreeTest),
unittest.makeSuite(TestIFBTrees),
-
unittest.makeSuite(TestIFMultiUnion),
unittest.makeSuite(PureIF),
+ unittest.makeSuite(IFBTreeConflictTests),
+ unittest.makeSuite(IFBucketConflictTests),
+ unittest.makeSuite(IFTreeSetConflictTests),
+ unittest.makeSuite(IFSetConflictTests),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_IIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_IIBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_IIBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -19,9 +19,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntKeys
from .common import TestLongIntValues
@@ -66,18 +68,6 @@
return IISet
-class IIModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'II'
-
- def _getModule(self):
- import BTrees
- return BTrees.IIBTree
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerIntegerBTreeModule
-
-
class IIBTreeTest(BTreeTests, unittest.TestCase):
def _makeOne(self):
@@ -229,7 +219,47 @@
return IIBucket, IIBTree, itemsToSet(IISet), itemsToSet(IITreeSet)
+class IIBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+ def _getTargetClass(self):
+ from BTrees.IIBTree import IIBTree
+ return IIBTree
+
+
+class IIBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IIBTree import IIBucket
+ return IIBucket
+
+
+class IITreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IIBTree import IITreeSet
+ return IITreeSet
+
+
+class IISetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IIBTree import IISet
+ return IISet
+
+
+class IIModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'II'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.IIBTree
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerIntegerBTreeModule
+
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(IIBTreeInternalKeyTest),
@@ -237,7 +267,6 @@
unittest.makeSuite(IIBucketTest),
unittest.makeSuite(IITreeSetTest),
unittest.makeSuite(IISetTest),
- unittest.makeSuite(IIModuleTest),
unittest.makeSuite(IIBTreeTest),
unittest.makeSuite(TestIIBTrees),
unittest.makeSuite(TestIISets),
@@ -245,4 +274,9 @@
unittest.makeSuite(TestIIMultiUnion),
unittest.makeSuite(PureII),
unittest.makeSuite(TestWeightedII),
+ unittest.makeSuite(IIBTreeConflictTests),
+ unittest.makeSuite(IIBucketConflictTests),
+ unittest.makeSuite(IITreeSetConflictTests),
+ unittest.makeSuite(IISetConflictTests),
+ unittest.makeSuite(IIModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_IOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_IOBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_IOBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -19,9 +19,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TypeTest
from .common import TestLongIntKeys
@@ -64,35 +66,6 @@
return IOSet
-class IOModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'IO'
-
- def _getModule(self):
- import BTrees
- return BTrees.IOBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerObjectBTreeModule
-
- def test_weightedUnion_not_present(self):
- try:
- from BTrees.IOBTree import weightedUnion
- except ImportError:
- pass
- else:
- self.fail("IOBTree shouldn't have weightedUnion")
-
- def test_weightedIntersection_not_present(self):
- try:
- from BTrees.IOBTree import weightedIntersection
- except ImportError:
- pass
- else:
- self.fail("IOBTree shouldn't have weightedIntersection")
-
-
class IOBTreeTest(BTreeTests, unittest.TestCase):
def _makeOne(self):
@@ -174,6 +147,63 @@
return mkbtree(*args)
+class IOBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IOBTree import IOBTree
+ return IOBTree
+
+
+class IOBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IOBTree import IOBucket
+ return IOBucket
+
+
+class IOTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IOBTree import IOTreeSet
+ return IOTreeSet
+
+
+class IOSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.IOBTree import IOSet
+ return IOSet
+
+
+class IOModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'IO'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.IOBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerObjectBTreeModule
+
+ def test_weightedUnion_not_present(self):
+ try:
+ from BTrees.IOBTree import weightedUnion
+ except ImportError:
+ pass
+ else:
+ self.fail("IOBTree shouldn't have weightedUnion")
+
+ def test_weightedIntersection_not_present(self):
+ try:
+ from BTrees.IOBTree import weightedIntersection
+ except ImportError:
+ pass
+ else:
+ self.fail("IOBTree shouldn't have weightedIntersection")
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(IOBTreeInternalKeyTest),
@@ -181,11 +211,15 @@
unittest.makeSuite(IOBucketTest),
unittest.makeSuite(IOTreeSetTest),
unittest.makeSuite(IOSetTest),
- unittest.makeSuite(IOModuleTest),
unittest.makeSuite(IOBTreeTest),
unittest.makeSuite(TestIOBTrees),
unittest.makeSuite(TestIOSets),
unittest.makeSuite(TestIOTreeSets),
unittest.makeSuite(TestIOMultiUnion),
unittest.makeSuite(PureIO),
+ unittest.makeSuite(IOBTreeConflictTests),
+ unittest.makeSuite(IOBucketConflictTests),
+ unittest.makeSuite(IOTreeSetConflictTests),
+ unittest.makeSuite(IOSetConflictTests),
+ unittest.makeSuite(IOModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_LFBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_LFBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_LFBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -18,9 +18,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntKeys
from .common import makeBuilder
@@ -61,19 +63,6 @@
return LFSet
-class LFModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'LF'
-
- def _getModule(self):
- import BTrees
- return BTrees.LFBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerFloatBTreeModule
-
-
class LFBTreeTest(BTreeTests, TestLongIntKeys, unittest.TestCase):
def _makeOne(self):
@@ -123,6 +112,47 @@
return LFSet, LFTreeSet, makeBuilder(LFBTree), makeBuilder(LFBucket)
+class LFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LFBTree import LFBTree
+ return LFBTree
+
+
+class LFBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LFBTree import LFBucket
+ return LFBucket
+
+
+class LFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LFBTree import LFTreeSet
+ return LFTreeSet
+
+
+class LFSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LFBTree import LFSet
+ return LFSet
+
+
+class LFModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'LF'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.LFBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerFloatBTreeModule
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(LFBTreeInternalKeyTest),
@@ -130,9 +160,12 @@
unittest.makeSuite(LFBucketTest),
unittest.makeSuite(LFTreeSetTest),
unittest.makeSuite(LFSetTest),
- unittest.makeSuite(LFModuleTest),
unittest.makeSuite(LFBTreeTest),
-
unittest.makeSuite(TestLFMultiUnion),
unittest.makeSuite(PureLF),
+ unittest.makeSuite(LFBTreeConflictTests),
+ unittest.makeSuite(LFBucketConflictTests),
+ unittest.makeSuite(LFTreeSetConflictTests),
+ unittest.makeSuite(LFSetConflictTests),
+ unittest.makeSuite(LFModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_LLBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_LLBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_LLBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -19,9 +19,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntKeys
from .common import TestLongIntValues
@@ -72,19 +74,6 @@
return LLSet
-class LLModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'LL'
-
- def _getModule(self):
- import BTrees
- return BTrees.LLBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerIntegerBTreeModule
-
-
class LLBTreeTest(BTreeTests, TestLongIntKeys, TestLongIntValues,
unittest.TestCase):
@@ -172,6 +161,47 @@
return LLBucket, LLBTree, itemsToSet(LLSet), itemsToSet(LLTreeSet)
+class LLBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LLBTree import LLBTree
+ return LLBTree
+
+
+class LLBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LLBTree import LLBucket
+ return LLBucket
+
+
+class LLTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LLBTree import LLTreeSet
+ return LLTreeSet
+
+
+class LLSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LLBTree import LLSet
+ return LLSet
+
+
+class LLModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'LL'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.LLBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerIntegerBTreeModule
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(LLBTreeInternalKeyTest),
@@ -183,8 +213,11 @@
unittest.makeSuite(LLBTreeTest),
unittest.makeSuite(TestLLSets),
unittest.makeSuite(TestLLTreeSets),
-
unittest.makeSuite(TestLLMultiUnion),
unittest.makeSuite(PureLL),
unittest.makeSuite(TestWeightedLL),
+ unittest.makeSuite(LLBTreeConflictTests),
+ unittest.makeSuite(LLBucketConflictTests),
+ unittest.makeSuite(LLTreeSetConflictTests),
+ unittest.makeSuite(LLSetConflictTests),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_LOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_LOBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_LOBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -19,9 +19,11 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import MultiUnion
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntKeys
from .common import makeBuilder
@@ -62,36 +64,7 @@
return LOSet
-class LOModuleTest(ModuleTest, unittest.TestCase):
- prefix = 'LO'
-
- def _getModule(self):
- import BTrees
- return BTrees.LOBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IIntegerObjectBTreeModule
-
- def test_weightedUnion_not_present(self):
- try:
- from BTrees.LOBTree import weightedUnion
- except ImportError:
- pass
- else:
- self.fail("LOBTree shouldn't have weightedUnion")
-
- def test_weightedIntersection_not_present(self):
- try:
- from BTrees.LOBTree import weightedIntersection
- except ImportError:
- pass
- else:
- self.fail("LOBTree shouldn't have weightedIntersection")
-
-
-
class LOBTreeTest(BTreeTests, TestLongIntKeys, unittest.TestCase):
def _makeOne(self):
@@ -152,6 +125,63 @@
return LOSet, LOTreeSet, makeBuilder(LOBTree), makeBuilder(LOBucket)
+class LOBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LOBTree import LOBTree
+ return LOBTree
+
+
+class LOBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LOBTree import LOBucket
+ return LOBucket
+
+
+class LOTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LOBTree import LOTreeSet
+ return LOTreeSet
+
+
+class LOSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.LOBTree import LOSet
+ return LOSet
+
+
+class LOModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'LO'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.LOBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IIntegerObjectBTreeModule
+
+ def test_weightedUnion_not_present(self):
+ try:
+ from BTrees.LOBTree import weightedUnion
+ except ImportError:
+ pass
+ else:
+ self.fail("LOBTree shouldn't have weightedUnion")
+
+ def test_weightedIntersection_not_present(self):
+ try:
+ from BTrees.LOBTree import weightedIntersection
+ except ImportError:
+ pass
+ else:
+ self.fail("LOBTree shouldn't have weightedIntersection")
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(LOBTreeInternalKeyTest),
@@ -159,11 +189,14 @@
unittest.makeSuite(LOBucketTest),
unittest.makeSuite(LOTreeSetTest),
unittest.makeSuite(LOSetTest),
- unittest.makeSuite(LOModuleTest),
unittest.makeSuite(LOBTreeTest),
unittest.makeSuite(TestLOSets),
unittest.makeSuite(TestLOTreeSets),
-
unittest.makeSuite(TestLOMultiUnion),
unittest.makeSuite(PureLO),
+ unittest.makeSuite(LOBTreeConflictTests),
+ unittest.makeSuite(LOBucketConflictTests),
+ unittest.makeSuite(LOTreeSetConflictTests),
+ unittest.makeSuite(LOSetConflictTests),
+ unittest.makeSuite(LOModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_OIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_OIBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_OIBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -18,8 +18,10 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntValues
from .common import TypeTest
@@ -64,27 +66,6 @@
return OISet
-class OIModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'OI'
-
- def _getModule(self):
- import BTrees
- return BTrees.OIBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IObjectIntegerBTreeModule
-
- def test_multiunion_not_present(self):
- try:
- from BTrees.OIBTree import multiunion
- except ImportError:
- pass
- else:
- self.fail("OIBTree shouldn't have multiunion")
-
-
class OIBTreeTest(BTreeTests, unittest.TestCase):
def _makeOne(self):
@@ -174,6 +155,55 @@
return OIBucket, OIBTree, itemsToSet(OISet), itemsToSet(OITreeSet)
+class OIBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OIBTree import OIBucket
+ return OIBucket
+
+
+class OISetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OIBTree import OISet
+ return OISet
+
+
+class OIBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OIBTree import OIBTree
+ return OIBTree
+
+
+class OITreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OIBTree import OITreeSet
+ return OITreeSet
+
+
+class OIModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'OI'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.OIBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IObjectIntegerBTreeModule
+
+ def test_multiunion_not_present(self):
+ try:
+ from BTrees.OIBTree import multiunion
+ except ImportError:
+ pass
+ else:
+ self.fail("OIBTree shouldn't have multiunion")
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(OIBTreeInternalKeyTest),
@@ -181,10 +211,13 @@
unittest.makeSuite(OIBucketTest),
unittest.makeSuite(OITreeSetTest),
unittest.makeSuite(OISetTest),
- unittest.makeSuite(OIModuleTest),
unittest.makeSuite(OIBTreeTest),
unittest.makeSuite(TestOIBTrees),
-
unittest.makeSuite(PureOI),
unittest.makeSuite(TestWeightedOI),
+ unittest.makeSuite(OIBucketConflictTests),
+ unittest.makeSuite(OISetConflictTests),
+ unittest.makeSuite(OIBTreeConflictTests),
+ unittest.makeSuite(OITreeSetConflictTests),
+ unittest.makeSuite(OIModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_OLBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_OLBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_OLBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -18,8 +18,10 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import NormalSetTests
+from .common import SetConflictTestBase
from .common import SetResult
from .common import TestLongIntValues
from .common import Weighted
@@ -62,27 +64,6 @@
return OLSet
-class OLModuleTest(ModuleTest, unittest.TestCase):
-
- prefix = 'OL'
-
- def _getModule(self):
- import BTrees
- return BTrees.OLBTree
-
- def _getInterface(self):
- import BTrees.Interfaces
- return BTrees.Interfaces.IObjectIntegerBTreeModule
-
- def test_multiunion_not_present(self):
- try:
- from BTrees.OLBTree import multiunion
- except ImportError:
- pass
- else:
- self.fail("OLBTree shouldn't have multiunion")
-
-
class OLBTreeTest(BTreeTests, TestLongIntValues, unittest.TestCase):
def _makeOne(self):
@@ -135,6 +116,55 @@
return OLBucket, OLBTree, itemsToSet(OLSet), itemsToSet(OLTreeSet)
+class OLBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OLBTree import OLBucket
+ return OLBucket
+
+
+class OLSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OLBTree import OLSet
+ return OLSet
+
+
+class OLBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OLBTree import OLBTree
+ return OLBTree
+
+
+class OLTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OLBTree import OLTreeSet
+ return OLTreeSet
+
+
+class OLModuleTest(ModuleTest, unittest.TestCase):
+
+ prefix = 'OL'
+
+ def _getModule(self):
+ import BTrees
+ return BTrees.OLBTree
+
+ def _getInterface(self):
+ import BTrees.Interfaces
+ return BTrees.Interfaces.IObjectIntegerBTreeModule
+
+ def test_multiunion_not_present(self):
+ try:
+ from BTrees.OLBTree import multiunion
+ except ImportError:
+ pass
+ else:
+ self.fail("OLBTree shouldn't have multiunion")
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(OLBTreeInternalKeyTest),
@@ -142,9 +172,12 @@
unittest.makeSuite(OLBucketTest),
unittest.makeSuite(OLTreeSetTest),
unittest.makeSuite(OLSetTest),
- unittest.makeSuite(OLModuleTest),
unittest.makeSuite(OLBTreeTest),
-
unittest.makeSuite(PureOL),
unittest.makeSuite(TestWeightedOL),
+ unittest.makeSuite(OLBucketConflictTests),
+ unittest.makeSuite(OLSetConflictTests),
+ unittest.makeSuite(OLBTreeConflictTests),
+ unittest.makeSuite(OLTreeSetConflictTests),
+ unittest.makeSuite(OLModuleTest),
))
Modified: BTrees/branches/pure_python/BTrees/tests/test_OOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test_OOBTree.py 2012-11-12 20:31:04 UTC (rev 128262)
+++ BTrees/branches/pure_python/BTrees/tests/test_OOBTree.py 2012-11-12 22:48:40 UTC (rev 128263)
@@ -18,12 +18,15 @@
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
+from .common import MappingConflictTestBase
from .common import ModuleTest
from .common import NormalSetTests
from .common import SetResult
+from .common import SetConflictTestBase
from .common import makeBuilder
+
class OOBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
def _getTargetClass(self):
@@ -192,6 +195,34 @@
makeBuilder(OOBTreePy), makeBuilder(OOBucketPy))
+class OOBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OOBTree import OOBucket
+ return OOBucket
+
+
+class OOSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OOBTree import OOSet
+ return OOSet
+
+
+class OOBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OOBTree import OOBTree
+ return OOBTree
+
+
+class OOTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
+
+ def _getTargetClass(self):
+ from BTrees.OOBTree import OOTreeSet
+ return OOTreeSet
+
+
class OOModuleTest(ModuleTest, unittest.TestCase):
prefix = 'OO'
@@ -245,5 +276,9 @@
unittest.makeSuite(OOBTreePyTest),
unittest.makeSuite(PureOO),
unittest.makeSuite(PureOOPy),
+ unittest.makeSuite(OOBucketConflictTests),
+ unittest.makeSuite(OOSetConflictTests),
+ unittest.makeSuite(OOBTreeConflictTests),
+ unittest.makeSuite(OOTreeSetConflictTests),
unittest.makeSuite(OOModuleTest),
))
More information about the checkins
mailing list