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

Method test_fixpath_in_weirdurls

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

Source from the content-addressed store, hash-verified

1165 self.assertEqual(r.selector, '')
1166
1167 def test_fixpath_in_weirdurls(self):
1168 # Issue4493: urllib2 to supply '/' when to urls where path does not
1169 # start with'/'
1170
1171 h = urllib.request.AbstractHTTPHandler()
1172 h.parent = MockOpener()
1173
1174 weird_url = 'http://www.python.org?getspam'
1175 req = Request(weird_url)
1176 newreq = h.do_request_(req)
1177 self.assertEqual(newreq.host, 'www.python.org')
1178 self.assertEqual(newreq.selector, '/?getspam')
1179
1180 url_without_path = 'http://www.python.org'
1181 req = Request(url_without_path)
1182 newreq = h.do_request_(req)
1183 self.assertEqual(newreq.host, 'www.python.org')
1184 self.assertEqual(newreq.selector, '')
1185
1186 def test_errors(self):
1187 h = urllib.request.HTTPErrorProcessor()

Callers

nothing calls this directly

Calls 4

do_request_Method · 0.95
RequestClass · 0.90
MockOpenerClass · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected