diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-26 15:24:42 +0200 |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-26 15:24:42 +0200 |
commit | 3da670749a25a9ea068c427f6b03812b92e75d13 (patch) | |
tree | b242c6f30cca23228dbd4033e637a83fbaf657e4 /Lib/test/test_urllib2.py | |
parent | 11a9bd62b1ef8956f590782be8b28a0a78c65a51 (diff) | |
parent | f0f7ceae3c94df171d94da1055236db1a93d85a9 (diff) | |
download | cpython-git-3da670749a25a9ea068c427f6b03812b92e75d13.tar.gz |
merge heads
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r-- | Lib/test/test_urllib2.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 089e04c795..b4f940ccf9 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -904,6 +904,30 @@ class HandlerTests(unittest.TestCase): p_ds_req = h.do_request_(ds_req) self.assertEqual(p_ds_req.unredirected_hdrs["Host"],"example.com") + def test_full_url_setter(self): + # Checks to ensure that components are set correctly after setting the + # full_url of a Request object + + urls = [ + 'http://example.com?foo=bar#baz', + 'http://example.com?foo=bar&spam=eggs#bash', + 'http://example.com', + ] + + # testing a reusable request instance, but the url parameter is + # required, so just use a dummy one to instantiate + r = Request('http://example.com') + for url in urls: + r.full_url = url + self.assertEqual(r.get_full_url(), url) + + def test_full_url_deleter(self): + r = Request('http://www.example.com') + del r.full_url + self.assertIsNone(r.full_url) + self.assertIsNone(r.fragment) + self.assertEqual(r.selector, '') + def test_fixpath_in_weirdurls(self): # Issue4493: urllib2 to supply '/' when to urls where path does not # start with'/' |