Remove test_wip.cpp,py (not needed anymore).

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-07-12 08:33:55 -07:00
parent d021bb10aa
commit 092d236b4e
2 changed files with 0 additions and 58 deletions

View File

@ -1,32 +0,0 @@
#include <pybind11/smart_holder.h>
#include "pybind11_tests.h"
namespace pybind11_tests {
namespace wip {
template <int SerNo> // Using int as a trick to easily generate a series of types.
struct Atype {
int val = 0;
explicit Atype(int val_) : val{val_} {}
int get() const { return val * 10 + SerNo; }
};
int mixed(std::unique_ptr<Atype<1>> at1, std::unique_ptr<Atype<2>> at2) {
return at1->get() * 200 + at2->get() * 20;
}
} // namespace wip
} // namespace pybind11_tests
using namespace pybind11_tests::wip;
PYBIND11_SMART_HOLDER_TYPE_CASTERS(Atype<1>)
PYBIND11_SMART_HOLDER_TYPE_CASTERS(Atype<2>)
TEST_SUBMODULE(wip, m) {
py::classh<Atype<1>>(m, "Atype1").def(py::init<int>()).def("get", &Atype<1>::get);
py::classh<Atype<2>>(m, "Atype2").def(py::init<int>()).def("get", &Atype<2>::get);
m.def("mixed", mixed);
}

View File

@ -1,26 +0,0 @@
from __future__ import annotations
import pytest
from pybind11_tests import wip as m
def test_mixed():
obj1a = m.Atype1(90)
obj2a = m.Atype2(25)
obj1b = m.Atype1(0)
obj2b = m.Atype2(0)
print("\nLOOOK A BEFORE m.mixed(obj1a, obj2a)", flush=True)
assert m.mixed(obj1a, obj2a) == (90 * 10 + 1) * 200 + (25 * 10 + 2) * 20
print("\nLOOOK A AFTER m.mixed(obj1a, obj2a)", flush=True)
print("\nLOOOK B BEFORE m.mixed(obj1b, obj2a)", flush=True)
with pytest.raises(ValueError):
m.mixed(obj1b, obj2a)
print("\nLOOOK B AFTER m.mixed(obj1b, obj2a)", flush=True)
print("\nLOOOK C BEFORE m.mixed(obj1a, obj2b)", flush=True)
with pytest.raises(ValueError):
m.mixed(obj1a, obj2b)
print("\nLOOOK C AFTER m.mixed(obj1a, obj2b)", flush=True)