[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees/tests - testBTrees.py:1.4
Jeremy Hylton
jeremy@zope.com
Wed, 12 Jun 2002 19:50:22 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv24051/Persistence/BTrees/tests
Modified Files:
testBTrees.py
Log Message:
Test the new repr code in buckets.
=== Zope3/lib/python/Persistence/BTrees/tests/testBTrees.py 1.3 => 1.4 ===
for i in range(l): t[i]=i
+ def testRepr(self):
+ # test the repr because buckets have a complex repr implementation
+ # internally the cutoff from a stack allocated buffer to a heap
+ # allocated buffer is 10000.
+ for i in range(1000):
+ self.t[i] = i
+ r = repr(self.t)
+ # make sure the repr is 10000 bytes long for a bucket
+ # XXX since we the test is also run for btrees, skip the length
+ # XXX check if the repr starts with '<'
+ if not r.startswith('<'):
+ self.assert_(len(r) > 10000)
+
def testGetItemFails(self):
self.assertRaises(KeyError, self._getitemfail)