summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2011-04-12 23:01:19 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2011-04-12 23:01:19 (GMT)
commit26430419703f925a9b6206ec96780ae899b6dd06 (patch)
treef6635d01d63acf63aa1a42d093a670e42ae64cc6 /Lib/test/test_urllib.py
parent3780542039d109ae747816dae208208be93240d6 (diff)
downloadcpython-26430419703f925a9b6206ec96780ae899b6dd06.zip
cpython-26430419703f925a9b6206ec96780ae899b6dd06.tar.gz
cpython-26430419703f925a9b6206ec96780ae899b6dd06.tar.bz2
Fix Issue11703 - urllib2.geturl() does not return correct url when the original url contains #fragment. Patch Contribution by Santoso Wijaya.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 2b88521..462a2b0 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -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