MCPcopy Index your code
hub / github.com/python/cpython / test_getcode

Method test_getcode

Lib/test/test_urllibnet.py:100–108  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

98 self.assertEqual(gotten_url, self.url)
99
100 def test_getcode(self):
101 # test getcode() with the fancy opener to get 404 error codes
102 URL = self.url + "XXXinvalidXXX"
103 with socket_helper.transient_internet(URL):
104 with self.assertRaises(urllib.error.URLError) as e:
105 with urllib.request.urlopen(URL):
106 pass
107 self.assertEqual(e.exception.code, 404)
108 e.exception.close()
109
110 @support.requires_resource('walltime')
111 def test_bad_address(self):

Callers

nothing calls this directly

Calls 4

assertRaisesMethod · 0.45
urlopenMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected