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

Function test_bound_method_callback

tests/test_callbacks.py:38–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36
37
38def test_bound_method_callback():
39 # Bound Python method:
40 class MyClass:
41 def double(self, val):
42 return 2 * val
43
44 z = MyClass()
45 assert m.test_callback3(z.double) == "func(43) = 86"
46
47 z = m.CppBoundMethodTest()
48 assert m.test_callback3(z.triple) == "func(43) = 129"
49
50
51def test_keyword_args_and_generalized_unpacking():

Callers

nothing calls this directly

Calls 1

MyClassClass · 0.70

Tested by

no test coverage detected