From b69b4a9f55dc1977571272bb466a8dddda17b273 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 3 Feb 2021 13:31:29 -0800 Subject: [PATCH] Converting as many py::class_ to py::classh as possible, not breaking tests. --- tests/test_class_sh_factory_constructors.cpp | 64 ++++++++++++-------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/tests/test_class_sh_factory_constructors.cpp b/tests/test_class_sh_factory_constructors.cpp index a820b4268..1cf45087f 100644 --- a/tests/test_class_sh_factory_constructors.cpp +++ b/tests/test_class_sh_factory_constructors.cpp @@ -57,73 +57,89 @@ std::unique_ptr rtrn_udcp() { return std::unique_ptr(m, "atyp_valu") + py::classh(m, "atyp_valu") .def(py::init(&rtrn_valu)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_rref") + py::classh(m, "atyp_rref") .def(py::init(&rtrn_rref)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_cref") - // ... must return a compatible ... + py::classh(m, "atyp_cref") + // class_: ... must return a compatible ... + // classh: ... cannot pass object of non-trivial type ... // .def(py::init(&rtrn_cref)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_mref") - // ... must return a compatible ... + py::classh(m, "atyp_mref") + // class_: ... must return a compatible ... + // classh: ... cannot pass object of non-trivial type ... // .def(py::init(&rtrn_mref)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_cptr") - // ... must return a compatible ... + py::classh(m, "atyp_cptr") + // class_: ... must return a compatible ... + // classh: ... must return a compatible ... // .def(py::init(&rtrn_cptr)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_mptr") + py::classh(m, "atyp_mptr") .def(py::init(&rtrn_mptr)) .def("get_mtxt", get_mtxt); + // NEEDED FOR FEATURE PARITY: shmp py::class_>(m, "atyp_shmp") + // py::classh(m, "atyp_shmp") + // classh: ... cannot pass object of non-trivial type ... .def(py::init(&rtrn_shmp)) .def("get_mtxt", get_mtxt); - py::class_>(m, "atyp_shcp") - // ... must return a compatible ... + // py::class_>(m, "atyp_shcp") + py::classh(m, "atyp_shcp") + // class_: ... must return a compatible ... + // classh: ... cannot pass object of non-trivial type ... // .def(py::init(&rtrn_shcp)) .def("get_mtxt", get_mtxt); + // NEEDED FOR FEATURE PARITY: uqmp py::class_(m, "atyp_uqmp") + // classh: ... cannot pass object of non-trivial type ... .def(py::init(&rtrn_uqmp)) .def("get_mtxt", get_mtxt); - py::class_(m, "atyp_uqcp") - // ... cannot pass object of non-trivial type ... + py::classh(m, "atyp_uqcp") + // class_: ... cannot pass object of non-trivial type ... + // classh: ... cannot pass object of non-trivial type ... // .def(py::init(&rtrn_uqcp)) .def("get_mtxt", get_mtxt); + // NEEDED FOR FEATURE PARITY: udmp py::class_>(m, "atyp_udmp") + // py::classh(m, "atyp_udmp") + // classh: ... cannot pass object of non-trivial type ... .def(py::init(&rtrn_udmp)) .def("get_mtxt", get_mtxt); - py::class_>(m, "atyp_udcp") - // ... must return a compatible ... + // py::class_>(m, "atyp_udcp") + py::classh(m, "atyp_udcp") + // class_: ... must return a compatible ... + // classh: ... cannot pass object of non-trivial type ... // .def(py::init(&rtrn_udcp)) .def("get_mtxt", get_mtxt); }