mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
Remove all (3) BAKEIN_BREAK from test_factory_constructors.cpp and all (4) BAKEIN_BREAK from test_factory_constructors.py (test_factory_constructors builds and runs successfully).
This commit is contained in:
parent
381fdc54e9
commit
8fe75ff85b
@ -228,20 +228,14 @@ TEST_SUBMODULE(factory_constructors, m) {
|
|||||||
|
|
||||||
// test_init_factory_basic, test_bad_type
|
// test_init_factory_basic, test_bad_type
|
||||||
py::class_<TestFactory1>(m, "TestFactory1")
|
py::class_<TestFactory1>(m, "TestFactory1")
|
||||||
#ifdef BAKEIN_BREAK
|
|
||||||
.def(py::init([](unique_ptr_tag, int v) { return TestFactoryHelper::construct1(v); }))
|
.def(py::init([](unique_ptr_tag, int v) { return TestFactoryHelper::construct1(v); }))
|
||||||
#endif
|
|
||||||
.def(py::init(&TestFactoryHelper::construct1_string)) // raw function pointer
|
.def(py::init(&TestFactoryHelper::construct1_string)) // raw function pointer
|
||||||
.def(py::init([](pointer_tag) { return TestFactoryHelper::construct1(); }))
|
.def(py::init([](pointer_tag) { return TestFactoryHelper::construct1(); }))
|
||||||
#ifdef BAKEIN_BREAK
|
|
||||||
.def(py::init(
|
.def(py::init(
|
||||||
[](py::handle, int v, py::handle) { return TestFactoryHelper::construct1(v); }))
|
[](py::handle, int v, py::handle) { return TestFactoryHelper::construct1(v); }))
|
||||||
#endif
|
|
||||||
.def_readwrite("value", &TestFactory1::value);
|
.def_readwrite("value", &TestFactory1::value);
|
||||||
py::class_<TestFactory2>(m, "TestFactory2")
|
py::class_<TestFactory2>(m, "TestFactory2")
|
||||||
#ifdef BAKEIN_BREAK
|
|
||||||
.def(py::init([](pointer_tag, int v) { return TestFactoryHelper::construct2(v); }))
|
.def(py::init([](pointer_tag, int v) { return TestFactoryHelper::construct2(v); }))
|
||||||
#endif
|
|
||||||
.def(py::init([](unique_ptr_tag, std::string v) {
|
.def(py::init([](unique_ptr_tag, std::string v) {
|
||||||
return TestFactoryHelper::construct2(std::move(v));
|
return TestFactoryHelper::construct2(std::move(v));
|
||||||
}))
|
}))
|
||||||
|
@ -19,7 +19,6 @@ def test_init_factory_basic():
|
|||||||
cstats[0].alive() # force gc
|
cstats[0].alive() # force gc
|
||||||
n_inst = ConstructorStats.detail_reg_inst()
|
n_inst = ConstructorStats.detail_reg_inst()
|
||||||
|
|
||||||
pytest.skip("BAKEIN_BREAK: TypeError")
|
|
||||||
x1 = m.TestFactory1(tag.unique_ptr, 3)
|
x1 = m.TestFactory1(tag.unique_ptr, 3)
|
||||||
assert x1.value == "3"
|
assert x1.value == "3"
|
||||||
y1 = m.TestFactory1(tag.pointer)
|
y1 = m.TestFactory1(tag.pointer)
|
||||||
@ -73,7 +72,6 @@ def test_init_factory_basic():
|
|||||||
def test_init_factory_signature(msg):
|
def test_init_factory_signature(msg):
|
||||||
with pytest.raises(TypeError) as excinfo:
|
with pytest.raises(TypeError) as excinfo:
|
||||||
m.TestFactory1("invalid", "constructor", "arguments")
|
m.TestFactory1("invalid", "constructor", "arguments")
|
||||||
pytest.skip("BAKEIN_BREAK: AssertionError")
|
|
||||||
assert (
|
assert (
|
||||||
msg(excinfo.value)
|
msg(excinfo.value)
|
||||||
== """
|
== """
|
||||||
@ -336,7 +334,6 @@ def test_multiple_inheritance():
|
|||||||
m.TestFactory1.__init__(self, tag.unique_ptr, 33)
|
m.TestFactory1.__init__(self, tag.unique_ptr, 33)
|
||||||
m.TestFactory2.__init__(self, tag.move)
|
m.TestFactory2.__init__(self, tag.move)
|
||||||
|
|
||||||
pytest.skip("BAKEIN_BREAK: TypeError")
|
|
||||||
a = MITest()
|
a = MITest()
|
||||||
assert m.TestFactory1.value.fget(a) == "33"
|
assert m.TestFactory1.value.fget(a) == "33"
|
||||||
assert m.TestFactory2.value.fget(a) == "(empty2)"
|
assert m.TestFactory2.value.fget(a) == "(empty2)"
|
||||||
@ -504,7 +501,6 @@ def test_invalid_self():
|
|||||||
NotPybindDerived.__new__(NotPybindDerived), tag.alias, 1
|
NotPybindDerived.__new__(NotPybindDerived), tag.alias, 1
|
||||||
)
|
)
|
||||||
|
|
||||||
pytest.skip("BAKEIN_BREAK: AssertionError")
|
|
||||||
for arg in (1, 2):
|
for arg in (1, 2):
|
||||||
with pytest.raises(TypeError) as excinfo:
|
with pytest.raises(TypeError) as excinfo:
|
||||||
BrokenTF1(arg)
|
BrokenTF1(arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user