File indexing completed on 2025-01-18 10:17:53
0001 from pybind11_tests import docstring_options as m
0002
0003
0004 def test_docstring_options():
0005
0006 assert not m.test_function1.__doc__
0007
0008 assert m.test_function2.__doc__ == "A custom docstring"
0009
0010
0011 assert m.test_overloaded1.__doc__ == "Overload docstring"
0012
0013
0014 assert m.test_overloaded2.__doc__ == "overload docstring 1\noverload docstring 2"
0015
0016
0017 assert m.test_overloaded3.__doc__ == "Overload docstr"
0018
0019
0020 assert m.test_function3.__doc__.startswith("test_function3(a: int, b: int) -> None")
0021
0022 assert m.test_function4.__doc__.startswith("test_function4(a: int, b: int) -> None")
0023 assert m.test_function4.__doc__.endswith("A custom docstring\n")
0024
0025
0026
0027 assert not m.test_function5.__doc__
0028
0029
0030 assert m.test_function6.__doc__ == "A custom docstring"
0031
0032
0033 assert m.test_function7.__doc__.startswith("test_function7(a: int, b: int) -> None")
0034 assert m.test_function7.__doc__.endswith("A custom docstring\n")
0035
0036
0037 assert m.test_function8.__doc__ is None
0038
0039
0040 assert not m.DocstringTestFoo.__doc__
0041 assert not m.DocstringTestFoo.value_prop.__doc__
0042
0043
0044 assert (
0045 m.DocstringTestEnum1.__doc__
0046 == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2"
0047 )
0048
0049
0050 assert (
0051 m.DocstringTestEnum2.__doc__
0052 == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2"
0053 )
0054
0055
0056 assert m.DocstringTestEnum3.__doc__ == "Enum docstring"
0057
0058
0059 assert m.DocstringTestEnum4.__doc__ == "Members:\n\n Member1\n\n Member2"
0060
0061
0062
0063
0064 assert m.DocstringTestEnum5.__doc__ is None