mirror of
https://github.com/pybind/pybind11.git
synced 2026-06-04 13:34:24 +08:00
Fully-automatic clang-format with include reordering (#3713)
* chore: add clang-format
* Removing check-style (Classic check-style)
Ported from @henryiii's 53056b1b0e
* Automatic clang-format changes (NO manual changes).
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e96221beff
commit
ec24786eab
@@ -7,10 +7,10 @@
|
||||
BSD-style license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
|
||||
#include <pybind11/eval.h>
|
||||
|
||||
#include "pybind11_tests.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
TEST_SUBMODULE(eval_, m) {
|
||||
@@ -20,16 +20,13 @@ TEST_SUBMODULE(eval_, m) {
|
||||
|
||||
m.def("test_eval_statements", [global]() {
|
||||
auto local = py::dict();
|
||||
local["call_test"] = py::cpp_function([&]() -> int {
|
||||
return 42;
|
||||
});
|
||||
local["call_test"] = py::cpp_function([&]() -> int { return 42; });
|
||||
|
||||
// Regular string literal
|
||||
py::exec(
|
||||
"message = 'Hello World!'\n"
|
||||
"x = call_test()",
|
||||
global, local
|
||||
);
|
||||
py::exec("message = 'Hello World!'\n"
|
||||
"x = call_test()",
|
||||
global,
|
||||
local);
|
||||
|
||||
// Multi-line raw string literal
|
||||
py::exec(R"(
|
||||
@@ -37,8 +34,9 @@ TEST_SUBMODULE(eval_, m) {
|
||||
print(message)
|
||||
else:
|
||||
raise RuntimeError
|
||||
)", global, local
|
||||
);
|
||||
)",
|
||||
global,
|
||||
local);
|
||||
auto x = local["x"].cast<int>();
|
||||
|
||||
return x == 42;
|
||||
@@ -53,9 +51,7 @@ TEST_SUBMODULE(eval_, m) {
|
||||
|
||||
m.def("test_eval_single_statement", []() {
|
||||
auto local = py::dict();
|
||||
local["call_test"] = py::cpp_function([&]() -> int {
|
||||
return 42;
|
||||
});
|
||||
local["call_test"] = py::cpp_function([&]() -> int { return 42; });
|
||||
|
||||
auto result = py::eval<py::eval_single_statement>("x = call_test()", py::dict(), local);
|
||||
auto x = local["x"].cast<int>();
|
||||
@@ -114,7 +110,9 @@ TEST_SUBMODULE(eval_, m) {
|
||||
|
||||
def func_local():
|
||||
return local_value
|
||||
)", global, local);
|
||||
)",
|
||||
global,
|
||||
local);
|
||||
return std::make_pair(global, local);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user