[Zope-Checkins] SVN: Zope/trunk/ - Collector #1265: Fixed handling
of orphans in ZTUtil.Batch
Andreas Jung
andreas at andreas-jung.com
Fri May 28 09:40:38 EDT 2004
Log message for revision 25080:
- Collector #1265: Fixed handling of orphans in ZTUtil.Batch
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2004-05-28 12:24:41 UTC (rev 25079)
+++ Zope/trunk/doc/CHANGES.txt 2004-05-28 13:40:38 UTC (rev 25080)
@@ -122,6 +122,8 @@
Bugs fixed
+ - Collector #1265: Fixed handling of orphans in ZTUtil.Batch
+
- Collector #1293: missing 'address' parameters within one of the server
sections raise an exception.
Modified: Zope/trunk/lib/python/ZTUtils/Batch.py
===================================================================
--- Zope/trunk/lib/python/ZTUtils/Batch.py 2004-05-28 12:24:41 UTC (rev 25079)
+++ Zope/trunk/lib/python/ZTUtils/Batch.py 2004-05-28 13:40:38 UTC (rev 25080)
@@ -105,7 +105,7 @@
if end < start: end=start
else:
end=start+size-1
- try: sequence[end+orphan-1]
+ try: sequence[end+orphan]
except IndexError: end=len(sequence)
elif end > 0:
try: sequence[end-1]
Modified: Zope/trunk/lib/python/ZTUtils/tests/testBatch.py
===================================================================
--- Zope/trunk/lib/python/ZTUtils/tests/testBatch.py 2004-05-28 12:24:41 UTC (rev 25079)
+++ Zope/trunk/lib/python/ZTUtils/tests/testBatch.py 2004-05-28 13:40:38 UTC (rev 25080)
@@ -42,6 +42,12 @@
assert b.sequence_length == 8
assert len(b.next) == 3
+ def testLengthEqualsSizePlusOrphans(self):
+ '''Test limit case where batch length is equal to size + orphans'''
+ for bsize in (12, 14):
+ b = Batch(range(bsize), size=10, start=1, end=0, orphan=3, overlap=0)
+ assert b.length = b.sequence_length
+
def test_suite():
return makeSuite(BatchTests)
More information about the Zope-Checkins
mailing list