Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
55afb1a2
Commit
55afb1a2
authored
Mar 15, 2011
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo an accidental commit.
parent
f47e3ac7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
Lib/test/test_urllibnet.py
Lib/test/test_urllibnet.py
+16
-18
No files found.
Lib/test/test_urllibnet.py
View file @
55afb1a2
...
...
@@ -46,7 +46,7 @@ class urlopenNetworkTests(unittest.TestCase):
with
support
.
transient_internet
(
resource
):
return
urllib
.
request
.
urlopen
(
*
args
,
**
kwargs
)
def
_
test_basic
(
self
):
def
test_basic
(
self
):
# Simple test expected to pass.
open_url
=
self
.
urlopen
(
"http://www.python.org/"
)
for
attr
in
(
"read"
,
"readline"
,
"readlines"
,
"fileno"
,
"close"
,
...
...
@@ -58,7 +58,7 @@ class urlopenNetworkTests(unittest.TestCase):
finally
:
open_url
.
close
()
def
_
test_readlines
(
self
):
def
test_readlines
(
self
):
# Test both readline and readlines.
open_url
=
self
.
urlopen
(
"http://www.python.org/"
)
try
:
...
...
@@ -69,7 +69,7 @@ class urlopenNetworkTests(unittest.TestCase):
finally
:
open_url
.
close
()
def
_
test_info
(
self
):
def
test_info
(
self
):
# Test 'info'.
open_url
=
self
.
urlopen
(
"http://www.python.org/"
)
try
:
...
...
@@ -81,7 +81,7 @@ class urlopenNetworkTests(unittest.TestCase):
"instance of email.message.Message"
)
self
.
assertEqual
(
info_obj
.
get_content_subtype
(),
"html"
)
def
_
test_geturl
(
self
):
def
test_geturl
(
self
):
# Make sure same URL as opened is returned by geturl.
URL
=
"http://www.python.org/"
open_url
=
self
.
urlopen
(
URL
)
...
...
@@ -94,14 +94,14 @@ class urlopenNetworkTests(unittest.TestCase):
def
test_getcode
(
self
):
# test getcode() with the fancy opener to get 404 error codes
URL
=
"http://www.python.org/XXXinvalidXXX"
open
er
=
urllib
.
request
.
FancyURLopener
(
)
self
.
addCleanup
(
opener
.
close
)
open_url
=
opener
.
open
(
URL
)
self
.
addCleanup
(
open_url
.
close
)
#code = open_url.getcod
e()
#
self.assertEqual(code, 404)
def
_
test_fileno
(
self
):
open
_url
=
urllib
.
request
.
FancyURLopener
().
open
(
URL
)
try
:
code
=
open_url
.
getcode
(
)
finally
:
open_url
.
clos
e
()
self
.
assertEqual
(
code
,
404
)
def
test_fileno
(
self
):
if
sys
.
platform
in
(
'win32'
,):
# On Windows, socket handles are not file descriptors; this
# test can't pass on Windows.
...
...
@@ -116,7 +116,7 @@ class urlopenNetworkTests(unittest.TestCase):
finally
:
FILE
.
close
()
def
_
test_bad_address
(
self
):
def
test_bad_address
(
self
):
# Make sure proper exception is raised when connecting to a bogus
# address.
self
.
assertRaises
(
IOError
,
...
...
@@ -185,11 +185,9 @@ class urlretrieveNetworkTests(unittest.TestCase):
def
test_main
():
support
.
requires
(
'network'
)
support
.
run_unittest
(
#URLTimeoutTest,
urlopenNetworkTests
,
#urlretrieveNetworkTests
)
support
.
run_unittest
(
URLTimeoutTest
,
urlopenNetworkTests
,
urlretrieveNetworkTests
)
if
__name__
==
"__main__"
:
test_main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment