#17471 - merge from 3.2
This commit is contained in:
commit
f47e77f343
|
@ -1504,11 +1504,17 @@ class RequestTests(unittest.TestCase):
|
||||||
interface even though HTTPError is a subclass of URLError.
|
interface even though HTTPError is a subclass of URLError.
|
||||||
|
|
||||||
>>> msg = 'something bad happened'
|
>>> 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)
|
>>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp)
|
||||||
>>> assert hasattr(err, 'reason')
|
>>> assert hasattr(err, 'reason')
|
||||||
>>> err.reason
|
>>> err.reason
|
||||||
'something bad happened'
|
'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):
|
def test_HTTPError_interface_call(self):
|
||||||
|
|
Loading…
Reference in New Issue