[Zope-Checkins] CVS: Zope/lib/python/ZPublisher/tests - testHTTPRangeSupport.py:1.7
Martijn Pieters
mj@zope.com
Wed, 21 Aug 2002 17:17:59 -0400
Update of /cvs-repository/Zope/lib/python/ZPublisher/tests
In directory cvs.zope.org:/tmp/cvs-serv15554/lib/python/ZPublisher/tests
Modified Files:
testHTTPRangeSupport.py
Log Message:
Merge fix for Zope Collector issue #530 from 2.5 branch; do not optimize
byte ranges because Acrobat Reader for Windows chokes when overlapping
ranges have been merged.
=== Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py 1.6 => 1.7 ===
--- Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py:1.6 Wed Aug 14 18:09:40 2002
+++ Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py Wed Aug 21 17:17:59 2002
@@ -12,7 +12,7 @@
##############################################################################
import sys
-from ZPublisher.HTTPRangeSupport import parseRange, optimizeRanges
+from ZPublisher.HTTPRangeSupport import parseRange, expandRanges
import unittest
@@ -77,10 +77,10 @@
self.expectSets('bytes=-0', [(sys.maxint, None)])
-class TestOptimizeRanges(unittest.TestCase):
+class TestExpandRanges(unittest.TestCase):
def expectSets(self, sets, size, expect):
- result = optimizeRanges(sets, size)
+ result = expandRanges(sets, size)
self.failUnless(result == expect,
'Expected %s, got %s' % (`expect`, `result`))
@@ -96,26 +96,26 @@
def testNoOverlapOutOfOrder(self):
self.expectSets([(1000, 2000), (3000, None), (1, 5)], 5000,
- [(1, 5), (1000, 2000), (3000, 5000)])
+ [(1000, 2000), (3000, 5000), (1, 5)])
def testOverlapInOrder(self):
self.expectSets([(1, 10), (8, 20), (25, None)], 5000,
- [(1, 20), (25, 5000)])
+ [(1, 10), (8, 20), (25, 5000)])
def testOverlapOutOfOrder(self):
self.expectSets([(25, 50), (8, None), (1, 10)], 5000,
- [(1, 5000)])
+ [(25, 50), (8, 5000), (1, 10)])
def testAdjacentInOrder(self):
self.expectSets([(1, 10), (10, 20), (25, 50)], 5000,
[(1, 10), (10, 20), (25, 50)])
def testAdjacentOutOfOrder(self):
- self.expectSets([(-5, None), (40, 45)], 50, [(40, 45), (45, 50)])
+ self.expectSets([(-5, None), (40, 45)], 50, [(45, 50), (40, 45)])
- def testOverLapAndOverflow(self):
+ def testOverlapAndOverflow(self):
# Note that one endpoint lies beyond the end.
- self.expectSets([(-5, None), (40, 100)], 50, [(40, 50)])
+ self.expectSets([(-5, None), (40, 100)], 50, [(45, 50), (40, 50)])
def testRemoveUnsatisfiable(self):
self.expectSets([(sys.maxint, None), (10, 20)], 50, [(10, 20)])
@@ -124,7 +124,7 @@
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRangeHeaderParse, 'test'))
- suite.addTest(unittest.makeSuite(TestOptimizeRanges, 'test'))
+ suite.addTest(unittest.makeSuite(TestExpandRanges, 'test'))
return suite
def main():