Skip to content

Commit ad3a3e2

Browse files
AWhetterrwgk
authored andcommitted
fixup! Prepend all function signatures to docstrings and disable headings
1 parent a2d7642 commit ad3a3e2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/test_docstring_options.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ TEST_SUBMODULE(docstring_options, m) {
9494
m.def("test_overloaded6", [](const py::none&, const py::none&)->py::none { return py::none(); },
9595
"Both numbers can be None, and None will be returned.");
9696
}
97+
98+
{
99+
py::options options;
100+
options.disable_section_headings();
101+
102+
m.def("test_overloaded7", [](int a, int b)->int { return a + b; },
103+
"A function which adds two numbers.\n");
104+
m.def("test_overloaded7", [](float a, float b)->float { return a + b; },
105+
"Internally, a simple addition is performed.");
106+
m.def("test_overloaded7", [](const py::none&, const py::none&)->py::none { return py::none(); },
107+
"Both numbers can be None, and None will be returned.");
108+
}
97109
}

tests/test_docstring_options.py

+8
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,11 @@ def test_docstring_options():
8080
"Internally, a simple addition is performed.\n"
8181
"Both numbers can be None, and None will be returned."
8282
)
83+
84+
assert m.test_overloaded7.__doc__ == (
85+
"test_overloaded7(*args, **kwargs)\n"
86+
"A function which adds two numbers.\n"
87+
"\n"
88+
"Internally, a simple addition is performed.\n"
89+
"Both numbers can be None, and None will be returned."
90+
)

0 commit comments

Comments
 (0)