summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2011-12-03 14:39:58 (GMT)
committerJason R. Coombs <jaraco@jaraco.com>2011-12-03 14:39:58 (GMT)
commit0612e8c2a25909788a8df7482670fd473e0f51ba (patch)
tree869a0361c87930be698091e9bddcbb0f78936341 /Lib/test/test_urllib2.py
parentc9b644eac28614ae74afb52432ad71d7077e8add (diff)
parentaa204dbe9c83302781f7b9d7df6db225b3661f9e (diff)
downloadcpython-0612e8c2a25909788a8df7482670fd473e0f51ba.zip
cpython-0612e8c2a25909788a8df7482670fd473e0f51ba.tar.gz
cpython-0612e8c2a25909788a8df7482670fd473e0f51ba.tar.bz2
Merged fix for #13211 from 3.2
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index aa1854d..cf6ccbc 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1449,6 +1449,17 @@ class RequestTests(unittest.TestCase):
req = Request(url)
self.assertEqual(req.get_full_url(), url)
+def test_HTTPError_interface():
+ """
+ Issue 13211 reveals that HTTPError didn't implement the URLError
+ interface even though HTTPError is a subclass of URLError.
+
+ >>> err = urllib.error.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None)
+ >>> assert hasattr(err, 'reason')
+ >>> err.reason
+ 'something bad happened'
+ """
+
def test_main(verbose=None):
from test import test_urllib2
support.run_doctest(test_urllib2, verbose)