Add py::class_<SomeType> with default ctor.

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-06-29 11:09:03 -07:00
parent ced85c95b1
commit e5907480f5
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,17 @@
#include "pybind11_tests.h" #include "pybind11_tests.h"
TEST_SUBMODULE(wip, m) { m.attr("__doc__") = "WIP"; } namespace pybind11_tests {
namespace wip {
struct SomeType {};
} // namespace wip
} // namespace pybind11_tests
TEST_SUBMODULE(wip, m) {
m.attr("__doc__") = "WIP";
using namespace pybind11_tests::wip;
py::class_<SomeType>(m, "SomeType").def(py::init<>());
}

View File

@ -5,3 +5,8 @@ from pybind11_tests import wip as m
def test_doc(): def test_doc():
assert m.__doc__ == "WIP" assert m.__doc__ == "WIP"
def test_some_type_ctor():
obj = m.SomeType()
assert isinstance(obj, m.SomeType)