[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees/tests - testSetOps.py:1.9

Tim Peters tim.one@comcast.net
Tue, 25 Jun 2002 14:02:00 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv9516/tests

Modified Files:
	testSetOps.py 
Log Message:
Added tests that special functions (like weightedUnion) are and aren't
supplied by the correct BTree modules.


=== Zope3/lib/python/Persistence/BTrees/tests/testSetOps.py 1.8 => 1.9 ===
     from Persistence.BTrees.IOBTree import IOBucket as mkbucket, IOBTree as mkbtree
 
+# Check that various special module functions are and aren't imported from
+# the expected BTree modules.
+class TestImports(TestCase):
+    def testWeightedUnion(self):
+        from Persistence.BTrees.IIBTree import weightedUnion
+        from Persistence.BTrees.OIBTree import weightedUnion
+
+        try:
+            from Persistence.BTrees.IOBTree import weightedUnion
+        except ImportError:
+            pass
+        else:
+            self.fail("IOBTree shouldn't have weightedUnion")
+
+        try:
+            from Persistence.BTrees.OOBTree import weightedUnion
+        except ImportError:
+            pass
+        else:
+            self.fail("OOBTree shouldn't have weightedUnion")
+
+    def testWeightedIntersection(self):
+        from Persistence.BTrees.IIBTree import weightedIntersection
+        from Persistence.BTrees.OIBTree import weightedIntersection
+
+        try:
+            from Persistence.BTrees.IOBTree import weightedIntersection
+        except ImportError:
+            pass
+        else:
+            self.fail("IOBTree shouldn't have weightedIntersection")
+
+        try:
+            from Persistence.BTrees.OOBTree import weightedIntersection
+        except ImportError:
+            pass
+        else:
+            self.fail("OOBTree shouldn't have weightedIntersection")
+
+    def testMultiunion(self):
+        from Persistence.BTrees.IIBTree import multiunion
+        from Persistence.BTrees.IOBTree import multiunion
+
+        try:
+            from Persistence.BTrees.OIBTree import multiunion
+        except ImportError:
+            pass
+        else:
+            self.fail("OIBTree shouldn't have multiunion")
+
+        try:
+            from Persistence.BTrees.OOBTree import multiunion
+        except ImportError:
+            pass
+        else:
+            self.fail("OOBTree shouldn't have multiunion")
+
+
 def test_suite():
     s = TestSuite()
     for klass in (TestIIMultiUnion, TestIOMultiUnion,
+                  TestImports,
                   PureII, PureIO, PureOI, PureOO):
         s.addTest(makeSuite(klass))
     return s