Skip to content

Commit

Permalink
Rename test_make_caster_adl to test_select_caster
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed May 7, 2022
1 parent 7e1626a commit 53e585d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/advanced/cast/custom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ C++ to Python.
The necessary conversion routines are defined by a caster class, which
is then "plugged into" pybind11 using one of two alternative mechanisms.

Starting with the example caster class:

.. code-block:: cpp
Expand Down Expand Up @@ -66,6 +67,7 @@ Starting with the example caster class:
}
return true;
}
// C++ -> Python: convert an inty instance into a Python object. The second and third arguments
// are used to indicate the return value policy and parent object (for
// return_value_policy::reference_internal) and are often ignored by custom casters.
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ set(PYBIND11_TEST_FILES
test_iostream
test_kwargs_and_defaults
test_local_bindings
test_make_caster_adl
test_make_caster_adl_alt
test_methods_and_attributes
test_modules
test_multiple_inheritance
Expand All @@ -150,6 +148,8 @@ set(PYBIND11_TEST_FILES
test_operator_overloading
test_pickling
test_pytypes
test_select_caster
test_select_caster_alt
test_sequences_and_iterators
test_smart_ptr
test_stl
Expand Down
1 change: 1 addition & 0 deletions tests/test_docs_advanced_cast_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct inty_type_caster {
}
return true;
}

// C++ -> Python: convert an inty instance into a Python object. The second and third arguments
// are used to indicate the return value policy and parent object (for
// return_value_policy::reference_internal) and are often ignored by custom casters.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// adl = Argument Dependent Lookup
// Copyright (c) 2022 The Pybind Development Team.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include "pybind11_tests.h"

Expand Down Expand Up @@ -73,7 +75,7 @@ struct minimal_real_caster {

} // namespace mrc_ns

TEST_SUBMODULE(make_caster_adl, m) {
TEST_SUBMODULE(select_caster, m) {
m.def("have_a_ns_num", []() { return py::detail::make_caster<have_a_ns::type_mock>::num(); });
m.def("global_ns_num", []() { return py::detail::make_caster<global_ns_type_mock>::num(); });
m.def("unnamed_ns_num", []() { return py::detail::make_caster<unnamed_ns_type_mock>::num(); });
Expand Down
4 changes: 2 additions & 2 deletions tests/test_make_caster_adl.py → tests/test_select_caster.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from pybind11_tests import make_caster_adl as m
from pybind11_tests import make_caster_adl_alt as m_alt
from pybind11_tests import select_caster as m
from pybind11_tests import select_caster_alt as m_alt


def test_mock_casters():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2022 The Pybind Development Team.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include "pybind11_tests.h"

namespace have_a_ns {
Expand All @@ -10,6 +14,6 @@ struct type_mock {

} // namespace have_a_ns

TEST_SUBMODULE(make_caster_adl_alt, m) {
TEST_SUBMODULE(select_caster_alt, m) {
m.def("have_a_ns_num", []() { return py::detail::make_caster<have_a_ns::type_mock>::num(); });
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pybind11_tests import make_caster_adl_alt as m
from pybind11_tests import select_caster_alt as m


def test_mock_casters():
Expand Down

0 comments on commit 53e585d

Please sign in to comment.