summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2013-03-19 23:46:34 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2013-03-19 23:46:34 (GMT)
commitf47e77f3437948992c0c9e0cdca481d59ebc14fa (patch)
tree9ac0cbce224c3faaaea82c90663b55282d1b498b
parent5cfbde0e8bc6e6c8857a5ffe5c2fd20fda398406 (diff)
parent2a4d24510ad120b492afd63e60a6f8060556897c (diff)
downloadcpython-f47e77f3437948992c0c9e0cdca481d59ebc14fa.zip
cpython-f47e77f3437948992c0c9e0cdca481d59ebc14fa.tar.gz
cpython-f47e77f3437948992c0c9e0cdca481d59ebc14fa.tar.bz2
#17471 - merge from 3.2
-rw-r--r--Lib/test/test_urllib2.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 3377cff..01f4dc4 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1504,11 +1504,17 @@ class RequestTests(unittest.TestCase):
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, 'hdrs')
+ >>> err.hdrs
+ 'Content-Length: 42'
+ >>> expected_errmsg = 'HTTP Error %s: %s' % (err.code, err.msg)
+ >>> assert str(err) == expected_errmsg
"""
def test_HTTPError_interface_call(self):