[Zodb-checkins] CVS: Zope/lib/python/BTrees/tests - testBTrees.py:1.45

Tim Peters tim.one@comcast.net
Fri, 28 Jun 2002 02:32:04 -0400


Update of /cvs-repository/Zope/lib/python/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv30448/tests

Modified Files:
	testBTrees.py 
Log Message:
New test testBadUpdateTupleSize().  This dumps core in Zope3; Zope2 is
fine; just keeping the test suite as closely in synch as possible.


=== Zope/lib/python/BTrees/tests/testBTrees.py 1.44 => 1.45 ===
         self.assertEqual(list(tslice), zip(range(20, 80), [1]*60))
 
+    def testBadUpdateTupleSize(self):
+        # This one silently ignored the excess in Zope3.
+        try:
+            self.t.update([(1, 2, 3)])
+        except TypeError:
+            pass
+        else:
+            self.fail("update() with 3-tuple didn't complain")
+
+        # This one dumped core in Zope3.
+        try:
+            self.t.update([(1,)])
+        except TypeError:
+            pass
+        else:
+            self.fail("update() with 1-tuple didn't complain")
+
+        # This one should simply succeed.
+        self.t.update([(1, 2)])
+        self.assertEqual(list(self.t.items()), [(1, 2)])
+
 
 class NormalSetTests(Base):
     """ Test common to all set types """