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

Method test_no_raise_message

testing/python/raises.py:223–238  ·  testing/python/raises.py::TestRaises.test_no_raise_message
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

intClass · 0.85

Tested by

no test coverage detected