MCPcopy Index your code
hub / github.com/python/cpython / test_full_url_setter

Method test_full_url_setter

Lib/test/test_urllib2.py:1154–1175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1152 self.assertEqual(p_ds_req.unredirected_hdrs["Host"], "example.com")
1153
1154 def test_full_url_setter(self):
1155 # Checks to ensure that components are set correctly after setting the
1156 # full_url of a Request object
1157
1158 urls = [
1159 'http://example.com?foo=bar#baz',
1160 'http://example.com?foo=bar&spam=eggs#bash',
1161 'http://example.com',
1162 ]
1163
1164 # testing a reusable request instance, but the url parameter is
1165 # required, so just use a dummy one to instantiate
1166 r = Request('http://example.com')
1167 for url in urls:
1168 r.full_url = url
1169 parsed = urlsplit(url)
1170
1171 self.assertEqual(r.get_full_url(), url)
1172 # full_url setter uses splittag to split into components.
1173 # splittag sets the fragment as None while urlparse sets it to ''
1174 self.assertEqual(r.fragment or '', parsed.fragment)
1175 self.assertEqual(urlsplit(r.get_full_url()).query, parsed.query)
1176
1177 def test_full_url_deleter(self):
1178 r = Request('http://www.example.com')

Callers

nothing calls this directly

Calls 4

get_full_urlMethod · 0.95
RequestClass · 0.90
urlsplitFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected