MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_error_already_set

Function test_error_already_set

tests/test_exceptions.py:20–30  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

18
19
20def test_error_already_set(msg):
21 with pytest.raises(RuntimeError) as excinfo:
22 m.throw_already_set(False)
23 assert (
24 msg(excinfo.value)
25 == "Internal error: pybind11::error_already_set called while Python error indicator not set."
26 )
27
28 with pytest.raises(ValueError) as excinfo:
29 m.throw_already_set(True)
30 assert msg(excinfo.value) == "foo"
31
32
33def test_raise_from(msg):

Callers

nothing calls this directly

Calls 1

msgFunction · 0.85

Tested by

no test coverage detected