summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-12-24 01:18:13 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-12-24 01:18:13 (GMT)
commit794921a2ed751f20bd13ec09aae2a3c00d5c8161 (patch)
treeeccb6a093a98393d6372c40fe3b6b45c4319511e /Lib
parent5330aa5b26214c45ed894c7ab6872c004b6e1e43 (diff)
downloadcpython-794921a2ed751f20bd13ec09aae2a3c00d5c8161.zip
cpython-794921a2ed751f20bd13ec09aae2a3c00d5c8161.tar.gz
cpython-794921a2ed751f20bd13ec09aae2a3c00d5c8161.tar.bz2
Merged revisions 77016 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r77016 | benjamin.peterson | 2009-12-23 19:14:05 -0600 (Wed, 23 Dec 2009) | 9 lines Merged revisions 77014 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77014 | benjamin.peterson | 2009-12-23 19:09:53 -0600 (Wed, 23 Dec 2009) | 1 line fix alleged refleak ........ ................
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_urllib2.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index e6c51ec..a0fff26 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -301,10 +301,11 @@ class MockHTTPClass:
else:
self._tunnel_headers.clear()
- def request(self, method, url, body=None, headers={}):
+ def request(self, method, url, body=None, headers=None):
self.method = method
self.selector = url
- self.req_headers += headers.items()
+ if headers is not None:
+ self.req_headers += headers.items()
self.req_headers.sort()
if body:
self.data = body
@@ -424,7 +425,11 @@ class MockHTTPHandler(urllib.request.BaseHandler):
class MockHTTPSHandler(urllib.request.AbstractHTTPHandler):
# Useful for testing the Proxy-Authorization request by verifying the
# properties of httpcon
- httpconn = MockHTTPClass()
+
+ def __init__(self):
+ urllib.request.AbstractHTTPHandler.__init__(self)
+ self.httpconn = MockHTTPClass()
+
def https_open(self, req):
return self.do_open(self.httpconn, req)