Commit fa6a210e authored by Tres Seaver's avatar Tres Seaver

Test pure-Python OL entities everywhere.

parent f795a954
......@@ -32,17 +32,18 @@ addresses and/or object identity (the synthesized bucket has an address
that doesn't exist in the actual BTree).
"""
from BTrees.OOBTree import OOBTree, OOBucket, OOSet, OOTreeSet
from BTrees.OOBTree import OOBTreePy, OOBucketPy, OOSetPy, OOTreeSetPy
from BTrees.IFBTree import IFBTree, IFBucket, IFSet, IFTreeSet
from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet
from BTrees.LLBTree import LLBTree, LLBucket, LLSet, LLTreeSet
from BTrees.LOBTree import LOBTree, LOBucket, LOSet, LOTreeSet
from BTrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet
from BTrees.OIBTree import OIBTreePy, OIBucketPy, OISetPy, OITreeSetPy
from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
from BTrees.IFBTree import IFBTree, IFBucket, IFSet, IFTreeSet
from BTrees.OLBTree import OLBTree, OLBucket, OLSet, OLTreeSet
from BTrees.LOBTree import LOBTree, LOBucket, LOSet, LOTreeSet
from BTrees.LLBTree import LLBTree, LLBucket, LLSet, LLTreeSet
from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet
from BTrees.OLBTree import OLBTreePy, OLBucketPy, OLSetPy, OLTreeSetPy
from BTrees.OOBTree import OOBTree, OOBucket, OOSet, OOTreeSet
from BTrees.OOBTree import OOBTreePy, OOBucketPy, OOSetPy, OOTreeSetPy
from BTrees.utils import positive_id
from BTrees.utils import oid_repr
......
......@@ -36,6 +36,13 @@ class OLBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
return OLBTree
class OLBTreePyInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLBTreePy
return OLBTreePy
class OLTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
def _getTargetClass(self):
......@@ -43,6 +50,13 @@ class OLTreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
return OLTreeSet
class OLTreeSetPyInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLTreeSetPy
return OLTreeSetPy
class OLBucketTest(MappingBase, unittest.TestCase):
def _getTargetClass(self):
......@@ -50,6 +64,13 @@ class OLBucketTest(MappingBase, unittest.TestCase):
return OLBucket
class OLBucketPyTest(MappingBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLBucketPy
return OLBucketPy
class OLTreeSetTest(NormalSetTests, unittest.TestCase):
def _getTargetClass(self):
......@@ -57,6 +78,13 @@ class OLTreeSetTest(NormalSetTests, unittest.TestCase):
return OLTreeSet
class OLTreeSetPyTest(NormalSetTests, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLTreeSetPy
return OLTreeSetPy
class OLSetTest(ExtendedSetTests, unittest.TestCase):
def _getTargetClass(self):
......@@ -64,6 +92,13 @@ class OLSetTest(ExtendedSetTests, unittest.TestCase):
return OLSet
class OLSetPyTest(ExtendedSetTests, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLSetPy
return OLSetPy
class OLBTreeTest(BTreeTests, TestLongIntValues, unittest.TestCase):
def _makeOne(self):
......@@ -74,16 +109,30 @@ class OLBTreeTest(BTreeTests, TestLongIntValues, unittest.TestCase):
return object(), object()
class OLBTreePyTest(BTreeTests, TestLongIntValues, unittest.TestCase):
def _makeOne(self):
from BTrees.OLBTree import OLBTreePy
return OLBTreePy()
def getTwoKeys(self):
return object(), object()
class PureOL(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OLBTree import union
return union(*args)
def intersection(self, *args):
from BTrees.OLBTree import intersection
return intersection(*args)
def difference(self, *args):
from BTrees.OLBTree import difference
return difference(*args)
def builders(self):
from BTrees.OLBTree import OLBTree
from BTrees.OLBTree import OLBucket
......@@ -92,22 +141,51 @@ class PureOL(SetResult, unittest.TestCase):
return OLSet, OLTreeSet, makeBuilder(OLBTree), makeBuilder(OLBucket)
class PureOLPy(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OLBTree import unionPy
return unionPy(*args)
def intersection(self, *args):
from BTrees.OLBTree import intersectionPy
return intersectionPy(*args)
def difference(self, *args):
from BTrees.OLBTree import differencePy
return differencePy(*args)
def builders(self):
from BTrees.OLBTree import OLBTreePy
from BTrees.OLBTree import OLBucketPy
from BTrees.OLBTree import OLTreeSetPy
from BTrees.OLBTree import OLSetPy
return (OLSetPy, OLTreeSetPy,
makeBuilder(OLBTreePy), makeBuilder(OLBucketPy))
class TestWeightedOL(Weighted, unittest.TestCase):
def weightedUnion(self):
from BTrees.OLBTree import weightedUnion
return weightedUnion
def weightedIntersection(self):
from BTrees.OLBTree import weightedIntersection
return weightedIntersection
def union(self):
from BTrees.OLBTree import union
return union
def intersection(self):
from BTrees.OLBTree import intersection
return intersection
def mkbucket(self, *args):
from BTrees.OLBTree import OLBucket as mkbucket
return mkbucket(*args)
def builders(self):
from BTrees.OLBTree import OLBTree
from BTrees.OLBTree import OLBucket
......@@ -116,6 +194,37 @@ class TestWeightedOL(Weighted, unittest.TestCase):
return OLBucket, OLBTree, itemsToSet(OLSet), itemsToSet(OLTreeSet)
class TestWeightedOLPy(Weighted, unittest.TestCase):
def weightedUnion(self):
from BTrees.OLBTree import weightedUnionPy
return weightedUnionPy
def weightedIntersection(self):
from BTrees.OLBTree import weightedIntersectionPy
return weightedIntersectionPy
def union(self):
from BTrees.OLBTree import unionPy
return unionPy
def intersection(self):
from BTrees.OLBTree import intersectionPy
return intersectionPy
def mkbucket(self, *args):
from BTrees.OLBTree import OLBucketPy as mkbucket
return mkbucket(*args)
def builders(self):
from BTrees.OLBTree import OLBTreePy
from BTrees.OLBTree import OLBucketPy
from BTrees.OLBTree import OLTreeSetPy
from BTrees.OLBTree import OLSetPy
return (OLBucketPy, OLBTreePy,
itemsToSet(OLSetPy), itemsToSet(OLTreeSetPy))
class OLBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
......@@ -123,6 +232,13 @@ class OLBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
return OLBucket
class OLBucketPyConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLBucketPy
return OLBucketPy
class OLSetConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
......@@ -130,6 +246,13 @@ class OLSetConflictTests(SetConflictTestBase, unittest.TestCase):
return OLSet
class OLSetPyConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLSetPy
return OLSetPy
class OLBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
......@@ -137,6 +260,13 @@ class OLBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
return OLBTree
class OLBTreePyConflictTests(MappingConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLBTreePy
return OLBTreePy
class OLTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
......@@ -144,6 +274,13 @@ class OLTreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
return OLTreeSet
class OLTreeSetPyConflictTests(SetConflictTestBase, unittest.TestCase):
def _getTargetClass(self):
from BTrees.OLBTree import OLTreeSetPy
return OLTreeSetPy
class OLModuleTest(ModuleTest, unittest.TestCase):
prefix = 'OL'
......@@ -168,16 +305,28 @@ class OLModuleTest(ModuleTest, unittest.TestCase):
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(OLBTreeInternalKeyTest),
unittest.makeSuite(OLBTreePyInternalKeyTest),
unittest.makeSuite(OLTreeSetInternalKeyTest),
unittest.makeSuite(OLTreeSetPyInternalKeyTest),
unittest.makeSuite(OLBucketTest),
unittest.makeSuite(OLBucketPyTest),
unittest.makeSuite(OLTreeSetTest),
unittest.makeSuite(OLTreeSetPyTest),
unittest.makeSuite(OLSetTest),
unittest.makeSuite(OLSetPyTest),
unittest.makeSuite(OLBTreeTest),
unittest.makeSuite(OLBTreePyTest),
unittest.makeSuite(PureOL),
unittest.makeSuite(PureOLPy),
unittest.makeSuite(TestWeightedOL),
unittest.makeSuite(TestWeightedOLPy),
unittest.makeSuite(OLBucketConflictTests),
unittest.makeSuite(OLBucketPyConflictTests),
unittest.makeSuite(OLSetConflictTests),
unittest.makeSuite(OLSetPyConflictTests),
unittest.makeSuite(OLBTreeConflictTests),
unittest.makeSuite(OLBTreePyConflictTests),
unittest.makeSuite(OLTreeSetConflictTests),
unittest.makeSuite(OLTreeSetPyConflictTests),
unittest.makeSuite(OLModuleTest),
))
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