[Zope-Checkins] CVS: Zope2 - testRanges.py:1.1.2.2
Martijn Pieters
mj@digicool.com
Wed, 18 Apr 2001 19:57:47 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/OFS/tests
In directory korak:/tmp/cvs-serv19456/tests
Modified Files:
Tag: mj-http_range_support-branch
testRanges.py
Log Message:
- Add a few end-overflow tests.
- Fix bugs exposed by tests.
--- Updated File testRanges.py in package Zope2 --
--- testRanges.py 2001/04/18 23:08:44 1.1.2.1
+++ testRanges.py 2001/04/18 23:57:46 1.1.2.2
@@ -207,7 +207,7 @@
def testOverLapAndOverflow(self):
# Note that one endpoint lies beyond the end.
- self.expectSets([(-5, None), (40, 100)], 50, [(40, 100)])
+ self.expectSets([(-5, None), (40, 100)], 50, [(40, 50)])
def testRemoveUnsatisfiable(self):
self.expectSets([(sys.maxint, None), (10, 20)], 50, [(10, 20)])
@@ -448,6 +448,12 @@
def testAdjacentRanges(self):
self.expectSingleRange('21-25,10-20', 10, 26)
+ def testEndOverflow(self):
+ l = len(self.data)
+ start, end = l - 10, l + 10
+ range = '%d-%d' % (start, end)
+ self.expectSingleRange(range, start, len(self.data))
+
def testBigFile(self):
# Files of size 1<<16 are stored in linked Pdata objects. They are
# treated seperately in the range code.
@@ -458,6 +464,13 @@
range = '%d-%d' % (start, end - 1)
self.expectSingleRange(range, start, end)
+ def testBigFileEndOverflow(self):
+ self.uploadBigFile()
+ l = len(self.data)
+ start, end = l - 100, l + 100
+ range = '%d-%d' % (start, end)
+ self.expectSingleRange(range, start, len(self.data))
+
# Multiple ranges
def testMultipleRanges(self):
self.expectMultipleRanges('3-7,10-15', [(3, 8), (10, 16)])
@@ -466,6 +479,13 @@
self.uploadBigFile()
self.expectMultipleRanges('3-700,10-15,-10000',
[(3, 701), (len(self.data) - 10000, len(self.data))])
+
+ def testMultipleRangesBigFileEndOverflow(self):
+ self.uploadBigFile()
+ l = len(self.data)
+ start, end = l - 100, l + 100
+ self.expectMultipleRanges('3-700,%s-%s' % (start, end),
+ [(3, 701), (len(self.data) - 100, len(self.data))])
# If-Range headers
def testIllegalIfRange(self):