From f99ffd7e03001810a3e722bf48ad1a9e08415d7d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 27 Aug 2024 01:56:00 +0700 Subject: [PATCH] Remove test_classh_mock.cpp,py (#5338) --- tests/CMakeLists.txt | 1 - tests/test_classh_mock.cpp | 73 -------------------------------------- tests/test_classh_mock.py | 13 ------- 3 files changed, 87 deletions(-) delete mode 100644 tests/test_classh_mock.cpp delete mode 100644 tests/test_classh_mock.py diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 99843ee4f2..53de1cd901 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -132,7 +132,6 @@ set(PYBIND11_TEST_FILES test_class_sh_unique_ptr_custom_deleter test_class_sh_unique_ptr_member test_class_sh_virtual_py_cpp_mix - test_classh_mock test_const_name test_constants_and_functions test_copy_move diff --git a/tests/test_classh_mock.cpp b/tests/test_classh_mock.cpp deleted file mode 100644 index 51be4ae082..0000000000 --- a/tests/test_classh_mock.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "pybind11_tests.h" - -// The main purpose of this test was to ensure that the suggested -// BOILERPLATE code block (NOW DEPRECATED!) block below is correct. - -// Copy this block of code into your project. -// Replace FOOEXT with the name of your project. -// BOILERPLATE BEGIN DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED -#ifdef FOOEXT_USING_PYBIND11_SMART_HOLDER -# include -#else -# include -PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) -# ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT -template -using classh = class_; -# endif -PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) -# ifndef PYBIND11_SH_AVL -# define PYBIND11_SH_AVL(...) std::shared_ptr<__VA_ARGS__> // "Smart_Holder if AVaiLable" -# endif -# ifndef PYBIND11_SH_DEF -# define PYBIND11_SH_DEF(...) std::shared_ptr<__VA_ARGS__> // "Smart_Holder if DEFault" -# endif -# ifndef PYBIND11_SMART_HOLDER_TYPE_CASTERS -# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(...) -# endif -# ifndef PYBIND11_TYPE_CASTER_BASE_HOLDER -# define PYBIND11_TYPE_CASTER_BASE_HOLDER(...) -# endif -#endif -// BOILERPLATE END DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED - -namespace { -struct FooUc {}; -struct FooUp {}; -struct FooSa {}; -struct FooSc {}; -struct FooSp {}; -} // namespace - -PYBIND11_SMART_HOLDER_TYPE_CASTERS(FooUp) // DEPRECATED -PYBIND11_SMART_HOLDER_TYPE_CASTERS(FooSp) // DEPRECATED - -PYBIND11_TYPE_CASTER_BASE_HOLDER(FooSa, std::shared_ptr) - -TEST_SUBMODULE(classh_mock, m) { - // Please see README_smart_holder.rst, in particular section - // Classic / Conservative / Progressive cross-module compatibility - - // Uses std::unique_ptr as holder in Classic or Conservative mode, py::smart_holder in - // Progressive mode. - py::class_(m, "FooUc").def(py::init<>()); - - // Uses std::unique_ptr as holder in Classic mode, py::smart_holder in Conservative or - // Progressive mode. - py::classh(m, "FooUp").def(py::init<>()); - - // Always uses std::shared_ptr as holder. - py::class_>(m, "FooSa").def(py::init<>()); - - // Uses std::shared_ptr as holder in Classic or Conservative mode, py::smart_holder in - // Progressive mode. - py::class_(m, "FooSc").def(py::init<>()); - // -------------- std::shared_ptr -- same length by design, to not disturb the - // indentation of existing code. - - // Uses std::shared_ptr as holder in Classic mode, py::smart_holder in Conservative or - // Progressive mode. - py::class_(m, "FooSp").def(py::init<>()); - // -------------- std::shared_ptr -- same length by design, to not disturb the - // indentation of existing code. -} diff --git a/tests/test_classh_mock.py b/tests/test_classh_mock.py deleted file mode 100644 index b05cd0c57c..0000000000 --- a/tests/test_classh_mock.py +++ /dev/null @@ -1,13 +0,0 @@ -from __future__ import annotations - -from pybind11_tests import classh_mock as m - - -def test_foobar(): - # Not really testing anything in particular. The main purpose of this test is to ensure the - # suggested BOILERPLATE code block in test_classh_mock.cpp is correct. - assert m.FooUc() - assert m.FooUp() - assert m.FooSa() - assert m.FooSc() - assert m.FooSp()