mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 14:59:27 +00:00
Always display python type information in cast errors (#4463)
* Always display python type information in cast errors * Address comments * Update comment
This commit is contained in:
@@ -5,6 +5,7 @@ import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
from pybind11_tests import callbacks as m
|
||||
from pybind11_tests import detailed_error_messages_enabled
|
||||
|
||||
|
||||
def test_callbacks():
|
||||
@@ -70,11 +71,20 @@ def test_keyword_args_and_generalized_unpacking():
|
||||
|
||||
with pytest.raises(RuntimeError) as excinfo:
|
||||
m.test_arg_conversion_error1(f)
|
||||
assert "Unable to convert call argument" in str(excinfo.value)
|
||||
assert str(excinfo.value) == "Unable to convert call argument " + (
|
||||
"'1' of type 'UnregisteredType' to Python object"
|
||||
if detailed_error_messages_enabled
|
||||
else "'1' to Python object (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)"
|
||||
)
|
||||
|
||||
with pytest.raises(RuntimeError) as excinfo:
|
||||
m.test_arg_conversion_error2(f)
|
||||
assert "Unable to convert call argument" in str(excinfo.value)
|
||||
assert str(excinfo.value) == "Unable to convert call argument " + (
|
||||
"'expected_name' of type 'UnregisteredType' to Python object"
|
||||
if detailed_error_messages_enabled
|
||||
else "'expected_name' to Python object "
|
||||
"(#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)"
|
||||
)
|
||||
|
||||
|
||||
def test_lambda_closure_cleanup():
|
||||
|
||||
Reference in New Issue
Block a user