mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Fix Issue11703 - urllib2.geturl() does not return correct url when the original url contains #fragment. Patch Contribution by Santoso Wijaya.
This commit is contained in:
parent
3780542039
commit
2643041970
4 changed files with 31 additions and 5 deletions
|
|
@ -171,6 +171,16 @@ class urlopen_HttpTests(unittest.TestCase):
|
|||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
def test_url_fragment(self):
|
||||
# Issue #11703: geturl() omits fragments in the original URL.
|
||||
url = 'http://docs.python.org/library/urllib.html#OK'
|
||||
self.fakehttp(b'Hello!')
|
||||
try:
|
||||
fp = urllib.request.urlopen(url)
|
||||
self.assertEqual(fp.geturl(), url)
|
||||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
def test_read_bogus(self):
|
||||
# urlopen() should raise IOError for many error codes.
|
||||
self.fakehttp(b'''HTTP/1.1 401 Authentication Required
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue