diff --git a/documentation/test_python/pybind_type_links/pybind_type_links.cpp b/documentation/test_python/pybind_type_links/pybind_type_links.cpp index eb54661a..eed8fb5a 100644 --- a/documentation/test_python/pybind_type_links/pybind_type_links.cpp +++ b/documentation/test_python/pybind_type_links/pybind_type_links.cpp @@ -9,7 +9,7 @@ enum class Enum { First, Second }; -void typeEnum(Enum) {} +void typeEnumAndDefault(Enum) {} struct Foo { Enum property; @@ -19,6 +19,8 @@ Foo typeReturn() { return {}; } void typeNested(const std::pair>&) {} +void typeNestedEnumAndDefault(std::pair) {} + } PYBIND11_MODULE(pybind_type_links, m) { @@ -34,9 +36,10 @@ PYBIND11_MODULE(pybind_type_links, m) { .def_readwrite("property", &Foo::property, "A property"); m - .def("type_enum", &typeEnum, "A function taking an enum", py::arg("value") = Enum::Second) + .def("type_enum_and_default", &typeEnumAndDefault, "A function taking an enum with a default", py::arg("value") = Enum::Second) .def("type_return", &typeReturn, "A function returning a type") - .def("type_nested", &typeNested, "A function with nested type annotation"); + .def("type_nested", &typeNested, "A function with nested type annotation") + .def("type_nested_enum_and_default", &typeNestedEnumAndDefault, "A function taking a nested enum with a default. This won't have a link.", py::arg("value") = std::pair{3, Enum::First}); /* Test also attributes (annotated from within Python) */ m.attr("TYPE_DATA") = Foo{Enum::First}; diff --git a/documentation/test_python/pybind_type_links/pybind_type_links.html b/documentation/test_python/pybind_type_links/pybind_type_links.html index 9c3c1965..b1239b43 100644 --- a/documentation/test_python/pybind_type_links/pybind_type_links.html +++ b/documentation/test_python/pybind_type_links/pybind_type_links.html @@ -57,14 +57,18 @@

Enums

Functions

-
- def type_enum(value: Enum = Enum.SECOND) -> None +
+ def type_enum_and_default(value: Enum = Enum.SECOND) -> None
-
A function taking an enum
+
A function taking an enum with a default
def type_nested(arg0: typing.Tuple[Foo, typing.List[Enum]], /) -> None
A function with nested type annotation
+
+ def type_nested_enum_and_default(value: typing.Tuple[int, Enum] = (3, Enum.FIRST)) -> None +
+
A function taking a nested enum with a default. This won't have a link.
def type_return() -> Foo