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

Function TEST_SUBMODULE

tests/test_class_sh_trampoline_unique_ptr.cpp:51–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49} // namespace pybind11_tests
50
51TEST_SUBMODULE(class_sh_trampoline_unique_ptr, m) {
52 using namespace pybind11_tests::class_sh_trampoline_unique_ptr;
53
54 py::classh<Class, PyClass>(m, "Class")
55 .def(py::init<>())
56 .def("set_val", &Class::setVal)
57 .def("get_val", &Class::getVal)
58 .def("clone", &Class::clone)
59 .def("foo", &Class::foo);
60
61 m.def("clone", [](const Class &obj) { return obj.clone(); });
62 m.def("clone_and_foo", [](const Class &obj) { return obj.clone()->foo(); });
63}

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.45
fooMethod · 0.45

Tested by

no test coverage detected