pybind11/tests
Ed Catmur 68a0b2dfd8
Add anyset & frozenset, enable copying (cast) to std::set (#3901)
* Add frozenset, and allow it cast to std::set

For the reverse direction, std::set still casts to set. This is in concordance with the behavior for sequence containers, where e.g. tuple casts to std::vector but std::vector casts to list.

Extracted from #3886.

* Rename set_base to any_set to match Python C API

since this will be part of pybind11 public API

* PR: static_cast, anyset

* Add tests for frozenset

and rename anyset methods

* Remove frozenset default ctor, add tests

Making frozenset non-default constructible means that we need to adjust pyobject_caster to not require that its value is default constructible, by initializing value to a nil handle.  This also allows writing C++ functions taking anyset, and is arguably a performance improvement, since there is no need to allocate an object that will just be replaced by load.

Add some more tests, including anyset::empty, anyset::size, set::add and set::clear.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add rationale to `pyobject_caster` default ctor

* Remove ineffectual protected: access control

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-05 12:09:56 -07:00
..
extra_python_package tests: use 'build' in tests instead of running setup.py (#3734) 2022-02-15 00:32:58 -05:00
extra_setuptools chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_cmake_build chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_embed fix: clear local internals after finalizing interpreter #2101 (#3744) 2022-02-20 08:00:29 -08:00
CMakeLists.txt Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
conftest.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
constructor_stats.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
cross_module_gil_utils.cpp chore: enable clang-tidy check modernize-use-nullptr (#3881) 2022-04-18 11:09:45 -04:00
env.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
local_bindings.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
object.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_cross_module_tests.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_tests.cpp Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913) 2022-05-02 15:30:19 -04:00
pybind11_tests.h Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
pytest.ini chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
requirements.txt tests: use 'build' in tests instead of running setup.py (#3734) 2022-02-15 00:32:58 -05:00
test_async.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_async.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_buffers.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_buffers.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_builtin_casters.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_builtin_casters.py Cast bytearray to string (#3707) 2022-02-23 18:21:03 -05:00
test_call_policies.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_call_policies.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_callbacks.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_callbacks.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_chrono.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_chrono.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_class.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_class.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_const_name.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_const_name.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_constants_and_functions.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_constants_and_functions.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_copy_move.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_copy_move.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_custom_type_casters.cpp cast: Qualify symbol usage in PYBIND11_TYPE_CASTER (#3758) 2022-02-25 13:25:23 -08:00
test_custom_type_casters.py cast: Qualify symbol usage in PYBIND11_TYPE_CASTER (#3758) 2022-02-25 13:25:23 -08:00
test_custom_type_setup.cpp Add custom_type_setup attribute (#3287) 2021-09-24 12:08:22 -07:00
test_custom_type_setup.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_docstring_options.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_docstring_options.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eigen.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_eigen.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_enum.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_enum.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eval_call.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eval.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_eval.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_exceptions.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_exceptions.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_exceptions.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_factory_constructors.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_factory_constructors.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_gil_scoped.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_gil_scoped.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_iostream.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_iostream.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_kwargs_and_defaults.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_kwargs_and_defaults.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_local_bindings.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_local_bindings.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_methods_and_attributes.cpp Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913) 2022-05-02 15:30:19 -04:00
test_methods_and_attributes.py Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913) 2022-05-02 15:30:19 -04:00
test_modules.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_modules.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_multiple_inheritance.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_multiple_inheritance.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_numpy_array.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_numpy_array.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_numpy_dtypes.cpp chore: Change numpy dtype from_args call sig to const ref (#3878) 2022-04-18 11:11:24 -04:00
test_numpy_dtypes.py Expand dtype accessors (#3868) 2022-04-14 10:53:16 -04:00
test_numpy_vectorize.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_numpy_vectorize.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_opaque_types.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_opaque_types.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_operator_overloading.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_operator_overloading.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_pickling.cpp Test pickling a simple callable (does not work). (#3906) 2022-05-02 12:39:36 -07:00
test_pickling.py Test pickling a simple callable (does not work). (#3906) 2022-05-02 12:39:36 -07:00
test_pytypes.cpp Add anyset & frozenset, enable copying (cast) to std::set (#3901) 2022-05-05 12:09:56 -07:00
test_pytypes.py Add anyset & frozenset, enable copying (cast) to std::set (#3901) 2022-05-05 12:09:56 -07:00
test_sequences_and_iterators.cpp docs: Correct minor typos (#3721) 2022-02-11 10:42:48 -05:00
test_sequences_and_iterators.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_smart_ptr.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_smart_ptr.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_stl_binders.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_stl_binders.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_stl.cpp Add type_caster<std::monostate> (#3818) 2022-03-21 22:58:04 -07:00
test_stl.py Add anyset & frozenset, enable copying (cast) to std::set (#3901) 2022-05-05 12:09:56 -07:00
test_tagbased_polymorphic.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_tagbased_polymorphic.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_thread.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_thread.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_union.cpp Fix assertion failure for unions (#1685) (#1709) 2019-06-11 23:28:58 +02:00
test_union.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_virtual_functions.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_virtual_functions.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
valgrind-numpy-scipy.supp docs: fix various typos (#3075) 2021-07-04 19:58:35 -04:00
valgrind-python.supp chore: get PyPy 3.7 wheels using NumPy 1.20 (#2837) 2021-01-31 17:29:09 -05:00