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

Method test_fixpath_in_weirdurls

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

Source from the content-addressed store, hash-verified

1182 self.assertEqual(r.selector, '')
1183
1184 def test_fixpath_in_weirdurls(self):
1185 # Issue4493: urllib2 to supply '/' when to urls where path does not
1186 # start with'/'
1187
1188 h = urllib.request.AbstractHTTPHandler()
1189 h.parent = MockOpener()
1190
1191 weird_url = 'http://www.python.org?getspam'
1192 req = Request(weird_url)
1193 newreq = h.do_request_(req)
1194 self.assertEqual(newreq.host, 'www.python.org')
1195 self.assertEqual(newreq.selector, '/?getspam')
1196
1197 url_without_path = 'http://www.python.org'
1198 req = Request(url_without_path)
1199 newreq = h.do_request_(req)
1200 self.assertEqual(newreq.host, 'www.python.org')
1201 self.assertEqual(newreq.selector, '')
1202
1203 def test_errors(self):
1204 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