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

Function test_pass_unique_ptr

tests/test_class.py:78–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77
78def test_pass_unique_ptr():
79 obj = m.ToBeHeldByUniquePtr()
80 with pytest.raises(RuntimeError) as execinfo:
81 m.pass_unique_ptr(obj)
82 assert str(execinfo.value).startswith(
83 "Passing `std::unique_ptr<T>` from Python to C++ requires `py::class_<T, py::smart_holder>` (with T = "
84 )
85 assert "ToBeHeldByUniquePtr" in str(execinfo.value)
86
87
88def test_type():

Callers

nothing calls this directly

Calls 1

strClass · 0.85

Tested by

no test coverage detected