MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_raise

Method test_raise

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

Source from the content-addressed store, hash-verified

643 self.assertEqual(o.calls[1][0], handlers[0])
644
645 def test_raise(self):
646 # raising URLError stops processing of request
647 o = OpenerDirector()
648 meth_spec = [
649 [("http_open", "raise")],
650 [("http_open", "return self")],
651 ]
652 handlers = add_ordered_mock_handlers(o, meth_spec)
653
654 req = Request("http://example.com/")
655 self.assertRaises(urllib.error.URLError, o.open, req)
656 self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})])
657
658 def test_http_error(self):
659 # 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