Skip to content

Commit dbacb07

Browse files
authored
Update test_urllibnet.py from 3.13.11 (#6432)
1 parent 835918a commit dbacb07

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/test/test_urllibnet.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from test import support
33
from test.support import os_helper
44
from test.support import socket_helper
5+
from test.support.testcase import ExtraAssertions
56

67
import contextlib
78
import socket
@@ -34,7 +35,7 @@ def testURLread(self):
3435
f.read()
3536

3637

37-
class urlopenNetworkTests(unittest.TestCase):
38+
class urlopenNetworkTests(unittest.TestCase, ExtraAssertions):
3839
"""Tests urllib.request.urlopen using the network.
3940
4041
These tests are not exhaustive. Assuming that testing using files does a
@@ -70,8 +71,7 @@ def test_basic(self):
7071
with self.urlopen(self.url) as open_url:
7172
for attr in ("read", "readline", "readlines", "fileno", "close",
7273
"info", "geturl"):
73-
self.assertTrue(hasattr(open_url, attr), "object returned from "
74-
"urlopen lacks the %s attribute" % attr)
74+
self.assertHasAttr(open_url, attr)
7575
self.assertTrue(open_url.read(), "calling 'read' failed")
7676

7777
def test_readlines(self):
@@ -109,6 +109,7 @@ def test_getcode(self):
109109
open_url.close()
110110
self.assertEqual(code, 404)
111111

112+
@support.requires_resource('walltime')
112113
def test_bad_address(self):
113114
# Make sure proper exception is raised when connecting to a bogus
114115
# address.
@@ -191,6 +192,7 @@ def test_header(self):
191192

192193
logo = "http://www.pythontest.net/"
193194

195+
@support.requires_resource('walltime')
194196
def test_data_header(self):
195197
with self.urlretrieve(self.logo) as (file_location, fileheaders):
196198
datevalue = fileheaders.get('Date')

0 commit comments

Comments
 (0)