3 m = pytest.importorskip(
"pybind11_tests.constants_and_functions")
7 assert m.some_constant == 14
11 assert m.test_function() ==
"test_function()"
12 assert m.test_function(7) ==
"test_function(7)"
13 assert m.test_function(m.MyEnum.EFirstEntry) ==
"test_function(enum=1)"
14 assert m.test_function(m.MyEnum.ESecondEntry) ==
"test_function(enum=2)"
16 assert m.test_function() ==
"test_function()"
17 assert m.test_function(
"abcd") ==
"test_function(char *)"
18 assert m.test_function(1, 1.0) ==
"test_function(int, float)"
19 assert m.test_function(1, 1.0) ==
"test_function(int, float)"
20 assert m.test_function(2.0, 2) ==
"test_function(float, int)"
24 assert m.print_bytes(m.return_bytes()) ==
"bytes[1 0 2 0]"
41 assert m.f4(140) == 144
47 raise RuntimeError(
"Surprise!")
49 with pytest.raises(RuntimeError):
50 m.register_large_capture_with_invalid_arguments(m)
51 with pytest.raises(RuntimeError):
52 m.register_with_raising_repr(m, RaisingRepr())