[Python-checkins] python/dist/src/Lib/test test_urllib2.py, 1.13, 1.14

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Tue Jun 29 09:15:49 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14526

Modified Files:
	test_urllib2.py 
Log Message:
Add test case for bug #912845: requesting an HTTP byte range doesn't work

Index: test_urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** test_urllib2.py	31 May 2004 18:22:40 -0000	1.13
--- test_urllib2.py	29 Jun 2004 13:15:46 -0000	1.14
***************
*** 671,683 ****
              self.assert_(False)
  
  
  def test_main(verbose=None):
      from test import test_sets
!     test_support.run_unittest(
!         TrivialTests,
!         OpenerDirectorTests,
!         HandlerTests,
!         MiscTests,
!     )
  
  if __name__ == "__main__":
--- 671,693 ----
              self.assert_(False)
  
+ class NetworkTests(unittest.TestCase):
+     def test_range (self):
+         req = urllib2.Request("http://www.python.org",
+                               headers={'Range': 'bytes=20-39'})
+         result = urllib2.urlopen(req)
+         data = result.read()
+         self.assertEqual(len(data), 20)
+ 
+         
  
  def test_main(verbose=None):
      from test import test_sets
!     tests = (TrivialTests,
!              OpenerDirectorTests,
!              HandlerTests,
!              MiscTests)
!     if test_support.is_resource_enabled('network'):
!         tests += (NetworkTests,)
!     test_support.run_unittest(*tests)
  
  if __name__ == "__main__":




More information about the Python-checkins mailing list