diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-08-08 11:27:53 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-08-08 11:27:53 (GMT) |
commit | d95cc754836762be6571aa44bcad1a01cf6def1d (patch) | |
tree | b93a7d02f984ab5820ed90705395ac4d1a2e9fc4 /Lib/test/test_urllib2.py | |
parent | ad537f23e2e60b92c67fe01855ec1a0a7479df46 (diff) | |
download | cpython-d95cc754836762be6571aa44bcad1a01cf6def1d.zip cpython-d95cc754836762be6571aa44bcad1a01cf6def1d.tar.gz cpython-d95cc754836762be6571aa44bcad1a01cf6def1d.tar.bz2 |
Fix Issue8280 - urllib2's Request method will remove fragements in the url.
This is how it should work,wget and curl work like this way too. Old behavior was wrong.
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r-- | Lib/test/test_urllib2.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index b2f7ea8..02dc83c 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1249,6 +1249,16 @@ class RequestTests(unittest.TestCase): self.assertEqual("www.python.org", self.get.get_origin_req_host()) self.assertEqual("www.perl.org", self.get.get_host()) + def test_wrapped_url(self): + req = Request("<URL:http://www.python.org>") + self.assertEqual("www.python.org", req.get_host()) + + def test_urlwith_fragment(self): + req = Request("http://www.python.org/?qs=query#fragment=true") + self.assertEqual("/?qs=query", req.get_selector()) + req = Request("http://www.python.org/#fun=true") + self.assertEqual("/", req.get_selector()) + def test_main(verbose=None): from test import test_urllib2 |