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

Method test_read_bogus

Lib/test/test_urllib.py:423–436  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

421 self.check_read(b"1.1")
422
423 def test_read_bogus(self):
424 # urlopen() should raise OSError for many error codes.
425 self.fakehttp(b'''HTTP/1.1 401 Authentication Required
426Date: Wed, 02 Jan 2008 03:03:54 GMT
427Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
428Connection: close
429Content-Type: text/html; charset=iso-8859-1
430''', mock_close=True)
431 try:
432 with self.assertRaises(urllib.error.HTTPError) as cm:
433 urllib.request.urlopen("http://python.org/")
434 cm.exception.close()
435 finally:
436 self.unfakehttp()
437
438 def test_invalid_redirect(self):
439 # urlopen() should raise OSError for many error codes.

Callers

nothing calls this directly

Calls 5

fakehttpMethod · 0.80
unfakehttpMethod · 0.80
assertRaisesMethod · 0.45
urlopenMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected