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

Function assertRaises

Lib/test/audit-tests.py:74–81  ·  view source on GitHub ↗
(ex_type)

Source from the content-addressed store, hash-verified

72
73@contextlib.contextmanager
74def assertRaises(ex_type):
75 try:
76 yield
77 assert False, f"expected {ex_type}"
78 except BaseException as ex:
79 if isinstance(ex, AssertionError):
80 raise
81 assert type(ex) is ex_type, f"{ex} should be {ex_type}"
82
83
84def test_basic():

Callers 5

test_pickleFunction · 0.85
test_openFunction · 0.85
test_incompatibleMethod · 0.85
test_invalidMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…