1 from __future__
import annotations
5 m = pytest.importorskip(
"pybind11_tests.constants_and_functions")
9 assert m.some_constant == 14
13 assert m.test_function() ==
"test_function()"
14 assert m.test_function(7) ==
"test_function(7)"
15 assert m.test_function(m.MyEnum.EFirstEntry) ==
"test_function(enum=1)"
16 assert m.test_function(m.MyEnum.ESecondEntry) ==
"test_function(enum=2)"
18 assert m.test_function() ==
"test_function()"
19 assert m.test_function(
"abcd") ==
"test_function(char *)"
20 assert m.test_function(1, 1.0) ==
"test_function(int, float)"
21 assert m.test_function(1, 1.0) ==
"test_function(int, float)"
22 assert m.test_function(2.0, 2) ==
"test_function(float, int)"
26 assert m.print_bytes(m.return_bytes()) ==
"bytes[1 0 2 0]"
43 assert m.f4(140) == 144
49 raise RuntimeError(
"Surprise!")
51 with pytest.raises(RuntimeError):
52 m.register_large_capture_with_invalid_arguments(m)
53 with pytest.raises(RuntimeError):
54 m.register_with_raising_repr(m, RaisingRepr())