Commit 5d675dc0 authored by Tres Seaver's avatar Tres Seaver

Move OI/OO-related set-op tests into OI/OO test modules.

parent 60352f47
......@@ -19,40 +19,6 @@ from .common import Weighted
from .common import itemsToSet
from .common import makeBuilder
class PureOO(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OOBTree import union
return union(*args)
def intersection(self, *args):
from BTrees.OOBTree import intersection
return intersection(*args)
def difference(self, *args):
from BTrees.OOBTree import difference
return difference(*args)
def builders(self):
from BTrees.OOBTree import OOBTree
from BTrees.OOBTree import OOBucket
from BTrees.OOBTree import OOTreeSet
from BTrees.OOBTree import OOSet
return OOSet, OOTreeSet, makeBuilder(OOBTree), makeBuilder(OOBucket)
class PureOI(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OIBTree import union
return union(*args)
def intersection(self, *args):
from BTrees.OIBTree import intersection
return intersection(*args)
def difference(self, *args):
from BTrees.OIBTree import difference
return difference(*args)
def builders(self):
from BTrees.OIBTree import OIBTree
from BTrees.OIBTree import OIBucket
from BTrees.OIBTree import OITreeSet
from BTrees.OIBTree import OISet
return OISet, OITreeSet, makeBuilder(OIBTree), makeBuilder(OIBucket)
class PureOL(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OLBTree import union
......@@ -157,29 +123,6 @@ class TestImports(unittest.TestCase):
else:
self.fail("OOBTree shouldn't have multiunion")
class TestWeightedOI(Weighted, unittest.TestCase):
def weightedUnion(self):
from BTrees.OIBTree import weightedUnion
return weightedUnion
def weightedIntersection(self):
from BTrees.OIBTree import weightedIntersection
return weightedIntersection
def union(self):
from BTrees.OIBTree import union
return union
def intersection(self):
from BTrees.OIBTree import intersection
return intersection
def mkbucket(self, *args):
from BTrees.OIBTree import OIBucket as mkbucket
return mkbucket(*args)
def builders(self):
from BTrees.OIBTree import OIBTree
from BTrees.OIBTree import OIBucket
from BTrees.OIBTree import OITreeSet
from BTrees.OIBTree import OISet
return OIBucket, OIBTree, itemsToSet(OISet), itemsToSet(OITreeSet)
class TestWeightedOL(Weighted, unittest.TestCase):
def weightedUnion(self):
from BTrees.OLBTree import weightedUnion
......@@ -207,11 +150,6 @@ class TestWeightedOL(Weighted, unittest.TestCase):
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(PureOO),
unittest.makeSuite(PureOI),
unittest.makeSuite(TestWeightedOI),
unittest.makeSuite(PureOL),
unittest.makeSuite(TestWeightedOL),
......
......@@ -13,15 +13,19 @@
##############################################################################
import unittest
from BTrees.tests.common import BTreeTests
from BTrees.tests.common import ExtendedSetTests
from BTrees.tests.common import InternalKeysMappingTest
from BTrees.tests.common import InternalKeysSetTest
from BTrees.tests.common import MappingBase
from BTrees.tests.common import ModuleTest
from BTrees.tests.common import NormalSetTests
from BTrees.tests.common import TestLongIntValues
from BTrees.tests.common import TypeTest
from .common import BTreeTests
from .common import ExtendedSetTests
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
from .common import ModuleTest
from .common import NormalSetTests
from .common import SetResult
from .common import TestLongIntValues
from .common import TypeTest
from .common import Weighted
from .common import itemsToSet
from .common import makeBuilder
from BTrees.IIBTree import using64bits #XXX Ugly, but necessary
......@@ -120,6 +124,48 @@ class TestOIBTrees(TypeTest, unittest.TestCase):
self.assertEqual(b.keys()[0], 30)
class PureOI(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OIBTree import union
return union(*args)
def intersection(self, *args):
from BTrees.OIBTree import intersection
return intersection(*args)
def difference(self, *args):
from BTrees.OIBTree import difference
return difference(*args)
def builders(self):
from BTrees.OIBTree import OIBTree
from BTrees.OIBTree import OIBucket
from BTrees.OIBTree import OITreeSet
from BTrees.OIBTree import OISet
return OISet, OITreeSet, makeBuilder(OIBTree), makeBuilder(OIBucket)
class TestWeightedOI(Weighted, unittest.TestCase):
def weightedUnion(self):
from BTrees.OIBTree import weightedUnion
return weightedUnion
def weightedIntersection(self):
from BTrees.OIBTree import weightedIntersection
return weightedIntersection
def union(self):
from BTrees.OIBTree import union
return union
def intersection(self):
from BTrees.OIBTree import intersection
return intersection
def mkbucket(self, *args):
from BTrees.OIBTree import OIBucket as mkbucket
return mkbucket(*args)
def builders(self):
from BTrees.OIBTree import OIBTree
from BTrees.OIBTree import OIBucket
from BTrees.OIBTree import OITreeSet
from BTrees.OIBTree import OISet
return OIBucket, OIBTree, itemsToSet(OISet), itemsToSet(OITreeSet)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(OIBTreeInternalKeyTest),
......@@ -130,4 +176,7 @@ def test_suite():
unittest.makeSuite(OIModuleTest),
unittest.makeSuite(OIBTreeTest),
unittest.makeSuite(TestOIBTrees),
unittest.makeSuite(PureOI),
unittest.makeSuite(TestWeightedOI),
))
......@@ -13,13 +13,15 @@
##############################################################################
import unittest
from BTrees.tests.common import BTreeTests
from BTrees.tests.common import ExtendedSetTests
from BTrees.tests.common import InternalKeysMappingTest
from BTrees.tests.common import InternalKeysSetTest
from BTrees.tests.common import MappingBase
from BTrees.tests.common import ModuleTest
from BTrees.tests.common import NormalSetTests
from .common import BTreeTests
from .common import ExtendedSetTests
from .common import InternalKeysMappingTest
from .common import InternalKeysSetTest
from .common import MappingBase
from .common import ModuleTest
from .common import NormalSetTests
from .common import SetResult
from .common import makeBuilder
class OOBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
......@@ -157,6 +159,24 @@ class OOModuleTest(ModuleTest, unittest.TestCase):
return BTrees.Interfaces.IObjectObjectBTreeModule
class PureOO(SetResult, unittest.TestCase):
def union(self, *args):
from BTrees.OOBTree import union
return union(*args)
def intersection(self, *args):
from BTrees.OOBTree import intersection
return intersection(*args)
def difference(self, *args):
from BTrees.OOBTree import difference
return difference(*args)
def builders(self):
from BTrees.OOBTree import OOBTree
from BTrees.OOBTree import OOBucket
from BTrees.OOBTree import OOTreeSet
from BTrees.OOBTree import OOSet
return OOSet, OOTreeSet, makeBuilder(OOBTree), makeBuilder(OOBucket)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(OOBTreeInternalKeyTest),
......@@ -173,4 +193,6 @@ def test_suite():
unittest.makeSuite(OOBTreeTest),
unittest.makeSuite(OOBTreePyTest),
unittest.makeSuite(OOModuleTest),
unittest.makeSuite(PureOO),
))
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