Commit 57617381 authored by Tres Seaver's avatar Tres Seaver

Test pure-Python IF entities everywhere.

parent fa6a210e
...@@ -33,6 +33,7 @@ that doesn't exist in the actual BTree). ...@@ -33,6 +33,7 @@ that doesn't exist in the actual BTree).
""" """
from BTrees.IFBTree import IFBTree, IFBucket, IFSet, IFTreeSet from BTrees.IFBTree import IFBTree, IFBucket, IFSet, IFTreeSet
from BTrees.IFBTree import IFBTreePy, IFBucketPy, IFSetPy, IFTreeSetPy
from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet
......
...@@ -36,6 +36,13 @@ class IFBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase): ...@@ -36,6 +36,13 @@ class IFBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
return IFBTree return IFBTree
class IFBTreePyInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFBTreePy
return IFBTreePy
class IFTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase): class IFTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -43,6 +50,13 @@ class IFTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase): ...@@ -43,6 +50,13 @@ class IFTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
return IFTreeSet return IFTreeSet
class IFTreeSetPyInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFTreeSetPy
return IFTreeSetPy
class IFBucketTest(MappingBase, unittest.TestCase): class IFBucketTest(MappingBase, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -50,12 +64,27 @@ class IFBucketTest(MappingBase, unittest.TestCase): ...@@ -50,12 +64,27 @@ class IFBucketTest(MappingBase, unittest.TestCase):
return IFBucket return IFBucket
class IFBucketPyTest(MappingBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFBucketPy
return IFBucketPy
class IFTreeSetTest(NormalSetTests, unittest.TestCase): class IFTreeSetTest(NormalSetTests, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
from BTrees.IFBTree import IFTreeSet from BTrees.IFBTree import IFTreeSet
return IFTreeSet return IFTreeSet
class IFTreeSetPyTest(NormalSetTests, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFTreeSetPy
return IFTreeSetPy
class IFSetTest(ExtendedSetTests, unittest.TestCase): class IFSetTest(ExtendedSetTests, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -63,27 +92,48 @@ class IFSetTest(ExtendedSetTests, unittest.TestCase): ...@@ -63,27 +92,48 @@ class IFSetTest(ExtendedSetTests, unittest.TestCase):
return IFSet return IFSet
class IFSetPyTest(ExtendedSetTests, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFSetPy
return IFSetPy
class IFBTreeTest(BTreeTests, unittest.TestCase): class IFBTreeTest(BTreeTests, unittest.TestCase):
def _makeOne(self): def _makeOne(self):
from BTrees.IFBTree import IFBTree from BTrees.IFBTree import IFBTree
return IFBTree() return IFBTree()
class IFBTreePyTest(BTreeTests, unittest.TestCase):
def _makeOne(self):
from BTrees.IFBTree import IFBTreePy
return IFBTreePy()
if using64bits: if using64bits:
class IFBTreeTest(BTreeTests, TestLongIntKeys, unittest.TestCase): class IFBTreeTest(BTreeTests, TestLongIntKeys, unittest.TestCase):
def _makeOne(self): def _makeOne(self):
from BTrees.IFBTree import IFBTree from BTrees.IFBTree import IFBTree
return IFBTree() return IFBTree()
def getTwoValues(self): def getTwoValues(self):
return 0.5, 1.5 return 0.5, 1.5
class IFBTreePyTest(BTreeTests, TestLongIntKeys, unittest.TestCase):
class TestIFBTrees(unittest.TestCase):
def _makeOne(self): def _makeOne(self):
from BTrees.IFBTree import IFBTree from BTrees.IFBTree import IFBTreePy
return IFBTree() return IFBTreePy()
def getTwoValues(self):
return 0.5, 1.5
class _TestIFBTreesBase(unittest.TestCase):
def testNonIntegerKeyRaises(self): def testNonIntegerKeyRaises(self):
self.assertRaises(TypeError, self._stringraiseskey) self.assertRaises(TypeError, self._stringraiseskey)
...@@ -114,36 +164,89 @@ class TestIFBTrees(unittest.TestCase): ...@@ -114,36 +164,89 @@ class TestIFBTrees(unittest.TestCase):
def _noneraisesvalue(self): def _noneraisesvalue(self):
self._makeOne()[1] = None self._makeOne()[1] = None
class TestIFBTrees(_TestIFBTreesBase, unittest.TestCase):
def _makeOne(self):
from BTrees.IFBTree import IFBTree
return IFBTree()
class TestIFBTreesPy(_TestIFBTreesBase, unittest.TestCase):
def _makeOne(self):
from BTrees.IFBTree import IFBTreePy
return IFBTreePy()
class TestIFMultiUnion(MultiUnion, unittest.TestCase): class TestIFMultiUnion(MultiUnion, unittest.TestCase):
def multiunion(self, *args): def multiunion(self, *args):
from BTrees.IFBTree import multiunion from BTrees.IFBTree import multiunion
return multiunion(*args) return multiunion(*args)
def union(self, *args): def union(self, *args):
from BTrees.IFBTree import union from BTrees.IFBTree import union
return union(*args) return union(*args)
def mkset(self, *args): def mkset(self, *args):
from BTrees.IFBTree import IFSet as mkset from BTrees.IFBTree import IFSet as mkset
return mkset(*args) return mkset(*args)
def mktreeset(self, *args): def mktreeset(self, *args):
from BTrees.IFBTree import IFTreeSet as mktreeset from BTrees.IFBTree import IFTreeSet as mktreeset
return mktreeset(*args) return mktreeset(*args)
def mkbucket(self, *args): def mkbucket(self, *args):
from BTrees.IFBTree import IFBucket as mkbucket from BTrees.IFBTree import IFBucket as mkbucket
return mkbucket(*args) return mkbucket(*args)
def mkbtree(self, *args): def mkbtree(self, *args):
from BTrees.IFBTree import IFBTree as mkbtree from BTrees.IFBTree import IFBTree as mkbtree
return mkbtree(*args) return mkbtree(*args)
class TestIFMultiUnionPy(MultiUnion, unittest.TestCase):
def multiunion(self, *args):
from BTrees.IFBTree import multiunionPy
return multiunionPy(*args)
def union(self, *args):
from BTrees.IFBTree import unionPy
return unionPy(*args)
def mkset(self, *args):
from BTrees.IFBTree import IFSetPy as mkset
return mkset(*args)
def mktreeset(self, *args):
from BTrees.IFBTree import IFTreeSetPy as mktreeset
return mktreeset(*args)
def mkbucket(self, *args):
from BTrees.IFBTree import IFBucketPy as mkbucket
return mkbucket(*args)
def mkbtree(self, *args):
from BTrees.IFBTree import IFBTreePy as mkbtree
return mkbtree(*args)
class PureIF(SetResult, unittest.TestCase): class PureIF(SetResult, unittest.TestCase):
def union(self, *args): def union(self, *args):
from BTrees.IFBTree import union from BTrees.IFBTree import union
return union(*args) return union(*args)
def intersection(self, *args): def intersection(self, *args):
from BTrees.IFBTree import intersection from BTrees.IFBTree import intersection
return intersection(*args) return intersection(*args)
def difference(self, *args): def difference(self, *args):
from BTrees.IFBTree import difference from BTrees.IFBTree import difference
return difference(*args) return difference(*args)
def builders(self): def builders(self):
from BTrees.IFBTree import IFBTree from BTrees.IFBTree import IFBTree
from BTrees.IFBTree import IFBucket from BTrees.IFBTree import IFBucket
...@@ -152,6 +255,29 @@ class PureIF(SetResult, unittest.TestCase): ...@@ -152,6 +255,29 @@ class PureIF(SetResult, unittest.TestCase):
return IFSet, IFTreeSet, makeBuilder(IFBTree), makeBuilder(IFBucket) return IFSet, IFTreeSet, makeBuilder(IFBTree), makeBuilder(IFBucket)
class PureIFPy(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.IFBTree import unionPy
return unionPy(*args)
def intersection(self, *args):
from BTrees.IFBTree import intersectionPy
return intersectionPy(*args)
def difference(self, *args):
from BTrees.IFBTree import differencePy
return differencePy(*args)
def builders(self):
from BTrees.IFBTree import IFBTreePy
from BTrees.IFBTree import IFBucketPy
from BTrees.IFBTree import IFTreeSetPy
from BTrees.IFBTree import IFSetPy
return (IFSetPy, IFTreeSetPy,
makeBuilder(IFBTreePy), makeBuilder(IFBucketPy))
class IFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase): class IFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -159,6 +285,13 @@ class IFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase): ...@@ -159,6 +285,13 @@ class IFBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
return IFBTree return IFBTree
class IFBTreePyConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFBTreePy
return IFBTreePy
class IFBucketConflictTests(MappingConflictTestBase, unittest.TestCase): class IFBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -166,6 +299,13 @@ class IFBucketConflictTests(MappingConflictTestBase, unittest.TestCase): ...@@ -166,6 +299,13 @@ class IFBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
return IFBucket return IFBucket
class IFBucketPyConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFBucketPy
return IFBucketPy
class IFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase): class IFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -173,6 +313,13 @@ class IFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase): ...@@ -173,6 +313,13 @@ class IFTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
return IFTreeSet return IFTreeSet
class IFTreeSetPyConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFTreeSetPy
return IFTreeSetPy
class IFSetConflictTests(SetConflictTestBase, unittest.TestCase): class IFSetConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
...@@ -180,6 +327,13 @@ class IFSetConflictTests(SetConflictTestBase, unittest.TestCase): ...@@ -180,6 +327,13 @@ class IFSetConflictTests(SetConflictTestBase, unittest.TestCase):
return IFSet return IFSet
class IFSetPyConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.IFBTree import IFSetPy
return IFSetPy
class IFModuleTest(ModuleTest, unittest.TestCase): class IFModuleTest(ModuleTest, unittest.TestCase):
prefix = 'IF' prefix = 'IF'
...@@ -195,17 +349,30 @@ class IFModuleTest(ModuleTest, unittest.TestCase): ...@@ -195,17 +349,30 @@ class IFModuleTest(ModuleTest, unittest.TestCase):
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
unittest.makeSuite(IFBTreeInternalKeyTest), unittest.makeSuite(IFBTreeInternalKeyTest),
unittest.makeSuite(IFBTreePyInternalKeyTest),
unittest.makeSuite(IFTreeSetInternalKeyTest), unittest.makeSuite(IFTreeSetInternalKeyTest),
unittest.makeSuite(IFTreeSetPyInternalKeyTest),
unittest.makeSuite(IFBucketTest), unittest.makeSuite(IFBucketTest),
unittest.makeSuite(IFBucketPyTest),
unittest.makeSuite(IFTreeSetTest), unittest.makeSuite(IFTreeSetTest),
unittest.makeSuite(IFTreeSetPyTest),
unittest.makeSuite(IFSetTest), unittest.makeSuite(IFSetTest),
unittest.makeSuite(IFModuleTest), unittest.makeSuite(IFSetPyTest),
unittest.makeSuite(IFBTreeTest), unittest.makeSuite(IFBTreeTest),
unittest.makeSuite(IFBTreePyTest),
unittest.makeSuite(TestIFBTrees), unittest.makeSuite(TestIFBTrees),
unittest.makeSuite(TestIFBTreesPy),
unittest.makeSuite(TestIFMultiUnion), unittest.makeSuite(TestIFMultiUnion),
unittest.makeSuite(TestIFMultiUnionPy),
unittest.makeSuite(PureIF), unittest.makeSuite(PureIF),
unittest.makeSuite(PureIFPy),
unittest.makeSuite(IFBTreeConflictTests), unittest.makeSuite(IFBTreeConflictTests),
unittest.makeSuite(IFBTreePyConflictTests),
unittest.makeSuite(IFBucketConflictTests), unittest.makeSuite(IFBucketConflictTests),
unittest.makeSuite(IFBucketPyConflictTests),
unittest.makeSuite(IFTreeSetConflictTests), unittest.makeSuite(IFTreeSetConflictTests),
unittest.makeSuite(IFTreeSetPyConflictTests),
unittest.makeSuite(IFSetConflictTests), unittest.makeSuite(IFSetConflictTests),
unittest.makeSuite(IFSetPyConflictTests),
unittest.makeSuite(IFModuleTest),
)) ))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment