Set error if it's not set in error_already_set()

This commit is contained in:
Ivan Smirnov
2016-09-07 21:10:16 +01:00
parent 392f16ccb8
commit 67b54894b2
3 changed files with 39 additions and 4 deletions

View File

@@ -1,6 +1,18 @@
import pytest
def test_error_already_set(msg):
from pybind11_tests import throw_already_set
with pytest.raises(RuntimeError) as excinfo:
throw_already_set(False)
assert msg(excinfo.value) == "Unknown internal error occurred"
with pytest.raises(ValueError) as excinfo:
throw_already_set(True)
assert msg(excinfo.value) == "foo"
def test_custom(msg):
from pybind11_tests import (MyException, throws1, throws2, throws3, throws4,
throws_logic_error)