From 7c06801638d24a8d7fe7223b5200bf466a31eeea Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Tue, 9 Oct 2012 01:03:35 -0700 Subject: Fix Issue 15922: make howto/urllib2.rst doctests pass. Patch by Chris Jerdonek. Address Ezio's review comment. --- Doc/howto/urllib2.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index e93473a..fe77d13 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -134,7 +134,7 @@ This is done as follows:: >>> data['location'] = 'Northampton' >>> data['language'] = 'Python' >>> url_values = urllib.urlencode(data) - >>> print url_values + >>> print url_values # The order may differ. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values @@ -201,9 +201,9 @@ e.g. :: >>> req = urllib2.Request('http://www.pretend_server.org') >>> try: urllib2.urlopen(req) - >>> except URLError, e: - >>> print e.reason - >>> + ... except URLError, e: + ... print e.reason #doctest: +SKIP + ... (4, 'getaddrinfo failed') @@ -309,18 +309,18 @@ geturl, and info, methods. :: >>> req = urllib2.Request('http://www.python.org/fish.html') >>> try: - >>> urllib2.urlopen(req) - >>> except HTTPError, e: - >>> print e.code - >>> print e.read() - >>> + ... urllib2.urlopen(req) + ... except urllib2.HTTPError, e: + ... print e.code + ... print e.read() #doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE + ... 404 - - - Error 404: File Not Found - ...... etc... + + ... + Page Not Found + ... + Wrapping it Up -------------- -- cgit v0.12