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

Method test_raise

Lib/test/test_urllib2.py:662–673  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

660 self.assertEqual(o.calls[1][0], handlers[0])
661
662 def test_raise(self):
663 # raising URLError stops processing of request
664 o = OpenerDirector()
665 meth_spec = [
666 [("http_open", "raise")],
667 [("http_open", "return self")],
668 ]
669 handlers = add_ordered_mock_handlers(o, meth_spec)
670
671 req = Request("http://example.com/")
672 self.assertRaises(urllib.error.URLError, o.open, req)
673 self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})])
674
675 def test_http_error(self):
676 # XXX http_error_default

Callers

nothing calls this directly

Calls 5

OpenerDirectorClass · 0.90
RequestClass · 0.90
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected