MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_full_url_setter

Method test_full_url_setter

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

Source from the content-addressed store, hash-verified

1135 self.assertEqual(p_ds_req.unredirected_hdrs["Host"], "example.com")
1136
1137 def test_full_url_setter(self):
1138 # Checks to ensure that components are set correctly after setting the
1139 # full_url of a Request object
1140
1141 urls = [
1142 'http://example.com?foo=bar#baz',
1143 'http://example.com?foo=bar&spam=eggs#bash',
1144 'http://example.com',
1145 ]
1146
1147 # testing a reusable request instance, but the url parameter is
1148 # required, so just use a dummy one to instantiate
1149 r = Request('http://example.com')
1150 for url in urls:
1151 r.full_url = url
1152 parsed = urlsplit(url)
1153
1154 self.assertEqual(r.get_full_url(), url)
1155 # full_url setter uses splittag to split into components.
1156 # splittag sets the fragment as None while urlparse sets it to ''
1157 self.assertEqual(r.fragment or '', parsed.fragment)
1158 self.assertEqual(urlsplit(r.get_full_url()).query, parsed.query)
1159
1160 def test_full_url_deleter(self):
1161 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