Skip to content

Commit 12c1024

Browse files
committed
Restoring tests/pybind11_tests.h version from master, removing just the comment and empty line that was added in PR pybind#3087; those were made obsolete by the pragma cleanup that concluded with PR pybind#3186.
1 parent d548339 commit 12c1024

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

tests/pybind11_tests.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#include <pybind11/eval.h>
43
#include <pybind11/pybind11.h>
4+
#include <pybind11/eval.h>
55

66
#if defined(_MSC_VER) && _MSC_VER < 1910
77
// We get some really long type names here which causes MSVC 2015 to emit warnings
@@ -26,13 +26,13 @@ class test_initializer {
2626
void test_submodule_##name(py::module_ &(variable))
2727

2828
/// Dummy type which is not exported anywhere -- something to trigger a conversion error
29-
struct UnregisteredType {};
29+
struct UnregisteredType { };
3030

3131
/// A user-defined type which is exported and can be used by any test
3232
class UserType {
3333
public:
3434
UserType() = default;
35-
UserType(int i) : i(i) {}
35+
UserType(int i) : i(i) { }
3636

3737
int value() const { return i; }
3838
void set(int set) { i = set; }
@@ -46,7 +46,7 @@ class IncType : public UserType {
4646
public:
4747
using UserType::UserType;
4848
IncType() = default;
49-
IncType(const IncType &other) : IncType(other.value() + 1) {}
49+
IncType(const IncType &other) : IncType(other.value() + 1) { }
5050
IncType(IncType &&) = delete;
5151
IncType &operator=(const IncType &) = delete;
5252
IncType &operator=(IncType &&) = delete;
@@ -58,21 +58,16 @@ union IntFloat {
5858
float f;
5959
};
6060

61-
/// Custom cast-only type that casts to a string "rvalue" or "lvalue" depending on the cast
62-
/// context. Used to test recursive casters (e.g. std::tuple, stl containers).
61+
/// Custom cast-only type that casts to a string "rvalue" or "lvalue" depending on the cast context.
62+
/// Used to test recursive casters (e.g. std::tuple, stl containers).
6363
struct RValueCaster {};
6464
PYBIND11_NAMESPACE_BEGIN(pybind11)
6565
PYBIND11_NAMESPACE_BEGIN(detail)
66-
template <>
67-
class type_caster<RValueCaster> {
66+
template<> class type_caster<RValueCaster> {
6867
public:
6968
PYBIND11_TYPE_CASTER(RValueCaster, _("RValueCaster"));
70-
static handle cast(RValueCaster &&, return_value_policy, handle) {
71-
return py::str("rvalue").release();
72-
}
73-
static handle cast(const RValueCaster &, return_value_policy, handle) {
74-
return py::str("lvalue").release();
75-
}
69+
static handle cast(RValueCaster &&, return_value_policy, handle) { return py::str("rvalue").release(); }
70+
static handle cast(const RValueCaster &, return_value_policy, handle) { return py::str("lvalue").release(); }
7671
};
7772
PYBIND11_NAMESPACE_END(detail)
7873
PYBIND11_NAMESPACE_END(pybind11)
@@ -86,6 +81,5 @@ void ignoreOldStyleInitWarnings(F &&body) {
8681
with warnings.catch_warnings():
8782
warnings.filterwarnings("ignore", message=message, category=FutureWarning)
8883
body()
89-
)",
90-
py::dict(py::arg("body") = py::cpp_function(body)));
84+
)", py::dict(py::arg("body") = py::cpp_function(body)));
9185
}

0 commit comments

Comments
 (0)