| 401 | |
| 402 | |
| 403 | def test_bad_arg_default(msg): |
| 404 | from pybind11_tests import detailed_error_messages_enabled |
| 405 | |
| 406 | with pytest.raises(RuntimeError) as excinfo: |
| 407 | m.bad_arg_def_named() |
| 408 | assert msg(excinfo.value) == ( |
| 409 | "arg(): could not convert default argument 'a: UnregisteredType' in function " |
| 410 | "'should_fail' into a Python object (type not registered yet?)" |
| 411 | if detailed_error_messages_enabled |
| 412 | else "arg(): could not convert default argument into a Python object (type not registered " |
| 413 | "yet?). #define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for more information." |
| 414 | ) |
| 415 | |
| 416 | with pytest.raises(RuntimeError) as excinfo: |
| 417 | m.bad_arg_def_unnamed() |
| 418 | assert msg(excinfo.value) == ( |
| 419 | "arg(): could not convert default argument 'UnregisteredType' in function " |
| 420 | "'should_fail' into a Python object (type not registered yet?)" |
| 421 | if detailed_error_messages_enabled |
| 422 | else "arg(): could not convert default argument into a Python object (type not registered " |
| 423 | "yet?). #define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for more information." |
| 424 | ) |
| 425 | |
| 426 | |
| 427 | def test_accepts_none(msg): |