Commit 64dc4180 authored by Andreas Jung's avatar Andreas Jung

parent 640d3af9
...@@ -122,6 +122,8 @@ Zope Changes ...@@ -122,6 +122,8 @@ Zope Changes
Bugs fixed Bugs fixed
- Collector #1265: Fixed handling of orphans in ZTUtil.Batch
- Collector #1293: missing 'address' parameters within one of the server - Collector #1293: missing 'address' parameters within one of the server
sections raise an exception. sections raise an exception.
......
...@@ -105,7 +105,7 @@ def opt(start,end,size,orphan,sequence): ...@@ -105,7 +105,7 @@ def opt(start,end,size,orphan,sequence):
if end < start: end=start if end < start: end=start
else: else:
end=start+size-1 end=start+size-1
try: sequence[end+orphan-1] try: sequence[end+orphan]
except IndexError: end=len(sequence) except IndexError: end=len(sequence)
elif end > 0: elif end > 0:
try: sequence[end-1] try: sequence[end-1]
......
...@@ -42,6 +42,12 @@ class BatchTests(TestCase): ...@@ -42,6 +42,12 @@ class BatchTests(TestCase):
assert b.sequence_length == 8 assert b.sequence_length == 8
assert len(b.next) == 3 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(): def test_suite():
return makeSuite(BatchTests) return makeSuite(BatchTests)
......
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