[Zope-Checkins] CVS: Zope/lib/python/OFS/tests - testRanges.py:1.11.12.1

Martijn Pieters mj@zope.com
Wed, 21 Aug 2002 16:51:48 -0400


Update of /cvs-repository/Zope/lib/python/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv9798/OFS/tests

Modified Files:
      Tag: Zope-2_5-branch
	testRanges.py 
Log Message:
Fix for Zope Collector issue #530 (http://collector.zope.org/Zope/530);
Adobe Acrobat for windows hangs on optimized byte ranges.

- Improve file byte range serving to allow arbitrary order byte ranges.

- Drop optimizations of byte ranges altogether; rename the method to
  expandRanges. This means we'll have to swallow loosing the small bandwidth
  wins we got from merging overlapping ranges (which was allowed under the
  RFC).

- Update the tests to follow the changes.


=== Zope/lib/python/OFS/tests/testRanges.py 1.11 => 1.11.12.1 ===
--- Zope/lib/python/OFS/tests/testRanges.py:1.11	Thu Dec  6 18:43:24 2001
+++ Zope/lib/python/OFS/tests/testRanges.py	Wed Aug 21 16:51:18 2002
@@ -303,7 +303,7 @@
 
     # Multiple ranges
     def testAdjacentRanges(self):
-        self.expectMultipleRanges('21-25,10-20', [(10, 21), (21, 26)])
+        self.expectMultipleRanges('21-25,10-20', [(21, 26), (10, 21)])
 
     def testMultipleRanges(self):
         self.expectMultipleRanges('3-7,10-15', [(3, 8), (10, 16)])
@@ -314,7 +314,13 @@
     def testMultipleRangesBigFile(self):
         self.uploadBigFile()
         self.expectMultipleRanges('3-700,10-15,-10000', 
-            [(3, 701), (len(self.data) - 10000, len(self.data))])
+            [(3, 701), (10, 16), (len(self.data) - 10000, len(self.data))])
+
+    def testMultipleRangesBigFileOutOfOrder(self):
+        self.uploadBigFile()
+        self.expectMultipleRanges('10-15,-10000,70000-80000', 
+            [(10, 16), (len(self.data) - 10000, len(self.data)),
+             (70000, 80001)])
 
     def testMultipleRangesBigFileEndOverflow(self):
         self.uploadBigFile()
@@ -327,10 +333,10 @@
     def testIllegalIfRange(self):
         # We assume that an illegal if-range is to be ignored, just like an
         # illegal if-modified since.
-        self.expectSingleRange('21-25,10-21', 10, 26, if_range='garbage')
+        self.expectSingleRange('10-25', 10, 26, if_range='garbage')
 
     def testEqualIfRangeDate(self):
-        self.expectSingleRange('21-25,10-21', 10, 26,
+        self.expectSingleRange('10-25', 10, 26,
             if_range=self.createLastModifiedDate())
 
     def testIsModifiedIfRangeDate(self):
@@ -338,15 +344,15 @@
             if_range=self.createLastModifiedDate(offset=-100))
 
     def testIsNotModifiedIfRangeDate(self):
-        self.expectSingleRange('21-25,10-21', 10, 26,
+        self.expectSingleRange('10-25', 10, 26,
             if_range=self.createLastModifiedDate(offset=100))
 
     def testEqualIfRangeEtag(self):
-        self.expectSingleRange('21-25,10-21', 10, 26,
+        self.expectSingleRange('10-25', 10, 26,
             if_range=self.file.http__etag())
 
     def testNotEqualIfRangeEtag(self):
-        self.expectOK('21-25,10-20',
+        self.expectOK('10-25',
             if_range=self.file.http__etag() + 'bar')