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

Function test_bad_arg_default

tests/test_methods_and_attributes.py:403–424  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

401
402
403def 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
427def test_accepts_none(msg):

Callers

nothing calls this directly

Calls 1

msgFunction · 0.85

Tested by

no test coverage detected