MCPcopy
hub / github.com/pytest-dev/pytest / test_no_raise_message

Method test_no_raise_message

testing/python/raises.py:223–238  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221 raise KeyError("oops")
222
223 def test_no_raise_message(self) -> None:
224 try:
225 with pytest.raises(ValueError):
226 int("0")
227 except pytest.fail.Exception as e:
228 assert e.msg == "DID NOT RAISE ValueError"
229 else:
230 assert False, "Expected pytest.raises.Exception"
231
232 try:
233 with pytest.raises(ValueError):
234 pass
235 except pytest.fail.Exception as e:
236 assert e.msg == "DID NOT RAISE ValueError"
237 else:
238 assert False, "Expected pytest.raises.Exception"
239
240 @pytest.mark.parametrize(
241 "method", ["function", "function_match", "with", "with_raisesexc", "with_group"]

Callers

nothing calls this directly

Calls 1

intClass · 0.85

Tested by

no test coverage detected