summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-12-10 10:09:35 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-12-10 10:09:35 (GMT)
commit5962cce05065c7d98a42f50b07c0d58c1c61790f (patch)
tree67b5dcc6d3ac29eafb28519a0c6ab299cd9272ff /Lib/test/test_urllib2.py
parent8e5a8296cc18d4f496549551bbf21d60ba535622 (diff)
downloadcpython-5962cce05065c7d98a42f50b07c0d58c1c61790f.zip
cpython-5962cce05065c7d98a42f50b07c0d58c1c61790f.tar.gz
cpython-5962cce05065c7d98a42f50b07c0d58c1c61790f.tar.bz2
Fix Issue15701 : add .headers attribute to urllib.error.HTTPError
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 2261d57..33042ed 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1539,11 +1539,15 @@ def test_HTTPError_interface():
interface even though HTTPError is a subclass of URLError.
>>> msg = 'something bad happened'
- >>> url = code = hdrs = fp = None
+ >>> url = code = fp = None
+ >>> hdrs = 'Content-Length: 42'
>>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp)
>>> assert hasattr(err, 'reason')
>>> err.reason
'something bad happened'
+ >>> assert hasattr(err, 'headers')
+ >>> err.headers
+ 'Content-Length: 42'
"""
def test_main(verbose=None):