diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2004-06-29 13:15:46 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2004-06-29 13:15:46 (GMT) |
commit | bd3200fa2bfa8a73d56de16b68d33d2e25583875 (patch) | |
tree | 990c94baa007eb4623751a30d4b65d1e3757a9f5 /Lib | |
parent | f1a2f9ec41e3477ae09da0ead52a573ec578de42 (diff) | |
download | cpython-bd3200fa2bfa8a73d56de16b68d33d2e25583875.zip cpython-bd3200fa2bfa8a73d56de16b68d33d2e25583875.tar.gz cpython-bd3200fa2bfa8a73d56de16b68d33d2e25583875.tar.bz2 |
Add test case for bug #912845: requesting an HTTP byte range doesn't work
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_urllib2.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 8a7cf65..8daa73b 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -670,15 +670,25 @@ class MiscTests(unittest.TestCase): else: 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 - test_support.run_unittest( - TrivialTests, - OpenerDirectorTests, - HandlerTests, - MiscTests, - ) + tests = (TrivialTests, + OpenerDirectorTests, + HandlerTests, + MiscTests) + if test_support.is_resource_enabled('network'): + tests += (NetworkTests,) + test_support.run_unittest(*tests) if __name__ == "__main__": test_main(verbose=True) |