MCPcopy Create free account
hub / github.com/pybind/pybind11 / register_test

Function register_test

tests/test_numpy_scalars.cpp:29–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <typename T, typename F>
29void register_test(py::module &m, const char *name, F &&func) {
30 m.def((std::string("test_") + name).c_str(),
31 [=](py::numpy_scalar<T> v) {
32 return std::make_tuple(name, py::make_scalar(static_cast<T>(func(v.value))));
33 },
34 py::arg("x"));
35}
36
37} // namespace pybind11_test_numpy_scalars
38

Callers

nothing calls this directly

Calls 4

make_tupleFunction · 0.85
make_scalarFunction · 0.85
funcFunction · 0.70
argClass · 0.50

Tested by

no test coverage detected