[Python-checkins] cpython (3.2): #17471 - Increasing the urllib.error test coverage. Bringing it to 100%. Based
senthil.kumaran
python-checkins at python.org
Wed Mar 20 00:49:28 CET 2013
http://hg.python.org/cpython/rev/ae9aea1b3546
changeset: 82808:ae9aea1b3546
branch: 3.2
parent: 82801:ec4486b5e845
user: Senthil Kumaran <senthil at uthcode.com>
date: Tue Mar 19 16:11:07 2013 -0700
summary:
#17471 - Increasing the urllib.error test coverage. Bringing it to 100%. Based on patch contributed by Daniel Wozniak
files:
Lib/test/test_urllib2.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1446,10 +1446,18 @@
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)
+ >>> msg = 'something bad happened'
+ >>> 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):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list