Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 31, 2023
1 parent bb42eea commit 3c39783
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def f(*args, **kwargs):
"'expected_name' of type 'UnregisteredType' to Python object"
if detailed_error_messages_enabled
else "'expected_name' to Python object "
"(#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)"
"(#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)"
)


Expand All @@ -104,20 +104,20 @@ def test_cpp_function_roundtrip():
"""Test if passing a function pointer from C++ -> Python -> C++ yields the original pointer"""

assert (
m.test_dummy_function(m.dummy_function) == "matches dummy_function: eval(1) = 2"
m.test_dummy_function(m.dummy_function) == "matches dummy_function: eval(1) = 2"
)
assert (
m.test_dummy_function(m.roundtrip(m.dummy_function))
== "matches dummy_function: eval(1) = 2"
m.test_dummy_function(m.roundtrip(m.dummy_function))
== "matches dummy_function: eval(1) = 2"
)
assert (
m.test_dummy_function(m.dummy_function_overloaded)
== "matches dummy_function: eval(1) = 2"
m.test_dummy_function(m.dummy_function_overloaded)
== "matches dummy_function: eval(1) = 2"
)
assert m.roundtrip(None, expect_none=True) is None
assert (
m.test_dummy_function(lambda x: x + 2)
== "can't convert to function pointer: eval(1) = 3"
m.test_dummy_function(lambda x: x + 2)
== "can't convert to function pointer: eval(1) = 3"
)

with pytest.raises(TypeError) as excinfo:
Expand Down Expand Up @@ -219,4 +219,7 @@ def test_custom_func2():


def test_callback_docstring():
assert m.test_tuple_unpacking.__doc__.strip() == "test_tuple_unpacking(arg0: Callable) -> object"
assert (
m.test_tuple_unpacking.__doc__.strip()
== "test_tuple_unpacking(arg0: Callable) -> object"
)

0 comments on commit 3c39783

Please sign in to comment.