Remove redundant test_class_sh_property_bakein.cpp,py

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-07-20 00:48:35 -07:00
parent 84f71f1b69
commit 9f9a698ee9
3 changed files with 0 additions and 54 deletions

View File

@ -132,7 +132,6 @@ set(PYBIND11_TEST_FILES
test_class_sh_mi_thunks
test_class_sh_module_local.py
test_class_sh_property
test_class_sh_property_bakein
test_class_sh_property_non_owning
test_class_sh_shared_ptr_copy_move
test_class_sh_trampoline_basic

View File

@ -1,35 +0,0 @@
#include "pybind11_tests.h"
#include <cstring>
namespace test_class_sh_property_bakein {
struct WithCharArrayMember {
WithCharArrayMember() { std::memcpy(char6_member, "Char6", 6); }
char char6_member[6];
};
struct WithConstCharPtrMember {
const char *const_char_ptr_member = "ConstChar*";
};
} // namespace test_class_sh_property_bakein
TEST_SUBMODULE(class_sh_property_bakein, m) {
m.attr("defined_PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
#ifndef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT
false;
#else
true;
using namespace test_class_sh_property_bakein;
py::class_<WithCharArrayMember>(m, "WithCharArrayMember")
.def(py::init<>())
.def_readonly("char6_member", &WithCharArrayMember::char6_member);
py::class_<WithConstCharPtrMember>(m, "WithConstCharPtrMember")
.def(py::init<>())
.def_readonly("const_char_ptr_member", &WithConstCharPtrMember::const_char_ptr_member);
#endif // PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT
}

View File

@ -1,18 +0,0 @@
from __future__ import annotations
import pytest
from pybind11_tests import class_sh_property_bakein as m
if not m.defined_PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
pytest.skip("smart_holder not available.", allow_module_level=True)
def test_readonly_char6_member():
obj = m.WithCharArrayMember()
assert obj.char6_member == "Char6"
def test_readonly_const_char_ptr_member():
obj = m.WithConstCharPtrMember()
assert obj.const_char_ptr_member == "ConstChar*"