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

Function test_function_signatures

tests/test_kwargs_and_defaults.py:9–87  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

7
8
9def test_function_signatures(doc):
10 assert (
11 doc(m.kw_func0)
12 == "kw_func0(arg0: typing.SupportsInt | typing.SupportsIndex, arg1: typing.SupportsInt | typing.SupportsIndex) -> str"
13 )
14 assert (
15 doc(m.kw_func1)
16 == "kw_func1(x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsInt | typing.SupportsIndex) -> str"
17 )
18 assert (
19 doc(m.kw_func2)
20 == "kw_func2(x: typing.SupportsInt | typing.SupportsIndex = 100, y: typing.SupportsInt | typing.SupportsIndex = 200) -> str"
21 )
22 assert doc(m.kw_func3) == "kw_func3(data: str = 'Hello world!') -> None"
23 assert (
24 doc(m.kw_func4)
25 == "kw_func4(myList: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex] = [13, 17]) -> str"
26 )
27 assert (
28 doc(m.kw_func_udl)
29 == "kw_func_udl(x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsInt | typing.SupportsIndex = 300) -> str"
30 )
31 assert (
32 doc(m.kw_func_udl_z)
33 == "kw_func_udl_z(x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsInt | typing.SupportsIndex = 0) -> str"
34 )
35 assert doc(m.args_function) == "args_function(*args) -> tuple"
36 assert (
37 doc(m.args_kwargs_function)
38 == "args_kwargs_function(*args, **kwargs) -> tuple[tuple, dict[str, typing.Any]]"
39 )
40 assert (
41 doc(m.args_kwargs_subclass_function)
42 == "args_kwargs_subclass_function(*args: str, **kwargs: str) -> tuple[tuple[str, ...], dict[str, str]]"
43 )
44 assert (
45 doc(m.KWClass.foo0)
46 == "foo0(self: m.kwargs_and_defaults.KWClass, arg0: typing.SupportsInt | typing.SupportsIndex, arg1: typing.SupportsFloat | typing.SupportsIndex) -> None"
47 )
48 assert (
49 doc(m.KWClass.foo1)
50 == "foo1(self: m.kwargs_and_defaults.KWClass, x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsFloat | typing.SupportsIndex) -> None"
51 )
52 assert (
53 doc(m.kw_lb_func0)
54 == "kw_lb_func0(custom: m.kwargs_and_defaults.CustomRepr = array([[A, B], [C, D]])) -> None"
55 )
56 assert (
57 doc(m.kw_lb_func1)
58 == "kw_lb_func1(custom: m.kwargs_and_defaults.CustomRepr = array([[A, B], [C, D]])) -> None"
59 )
60 assert (
61 doc(m.kw_lb_func2)
62 == "kw_lb_func2(custom: m.kwargs_and_defaults.CustomRepr = array([[A, B], [C, D]])) -> None"
63 )
64 assert (
65 doc(m.kw_lb_func3)
66 == "kw_lb_func3(custom: m.kwargs_and_defaults.CustomRepr = array([[A, B], [C, D]])) -> None"

Callers

nothing calls this directly

Calls 1

docFunction · 0.70

Tested by

no test coverage detected