diff -r 1ceb91974dc4 Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py Sat Apr 30 01:30:57 2016 +0000 +++ b/Lib/test/test_urllib2.py Sun May 01 00:38:36 2016 +0800 @@ -480,8 +480,8 @@ # Useful for testing the Proxy-Authorization request by verifying the # properties of httpcon - def __init__(self): - urllib.request.AbstractHTTPHandler.__init__(self) + def __init__(self, debuglevel=0): + urllib.request.AbstractHTTPHandler.__init__(self, debuglevel) self.httpconn = MockHTTPClass() def https_open(self, req): @@ -950,6 +950,13 @@ newreq = h.do_request_(req) self.assertEqual(int(newreq.get_header('Content-length')),16) + def test_http_handler_debuglevel(self): + o = OpenerDirector() + h = MockHTTPSHandler(debuglevel=1) + o.add_handler(h) + o.open("https://example.com/") + self.assertEqual(h.httpconn.level, 1) + def test_http_doubleslash(self): # Checks the presence of any unnecessary double slash in url does not # break anything. Previously, a double slash directly after the host