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

Function test_qualname

tests/test_class.py:157–194  ·  view source on GitHub ↗

Tests that a properly qualified name is set in __qualname__ and that generated docstrings properly use it and the module name

(doc)

Source from the content-addressed store, hash-verified

155
156
157def test_qualname(doc):
158 """Tests that a properly qualified name is set in __qualname__ and that
159 generated docstrings properly use it and the module name"""
160 assert m.NestBase.__qualname__ == "NestBase"
161 assert m.NestBase.Nested.__qualname__ == "NestBase.Nested"
162
163 assert (
164 doc(m.NestBase.__init__)
165 == """
166 __init__(self: m.class_.NestBase) -> None
167 """
168 )
169 assert (
170 doc(m.NestBase.g)
171 == """
172 g(self: m.class_.NestBase, arg0: m.class_.NestBase.Nested) -> None
173 """
174 )
175 assert (
176 doc(m.NestBase.Nested.__init__)
177 == """
178 __init__(self: m.class_.NestBase.Nested) -> None
179 """
180 )
181 assert (
182 doc(m.NestBase.Nested.fn)
183 == """
184 fn(self: m.class_.NestBase.Nested, arg0: typing.SupportsInt | typing.SupportsIndex, arg1: m.class_.NestBase, arg2: m.class_.NestBase.Nested) -> None
185 """
186 )
187 assert (
188 doc(m.NestBase.Nested.fa)
189 == """
190 fa(self: m.class_.NestBase.Nested, a: typing.SupportsInt | typing.SupportsIndex, b: m.class_.NestBase, c: m.class_.NestBase.Nested) -> None
191 """
192 )
193 assert m.NestBase.__module__ == "pybind11_tests.class_"
194 assert m.NestBase.Nested.__module__ == "pybind11_tests.class_"
195
196
197def test_inheritance(msg):

Callers

nothing calls this directly

Calls 1

docFunction · 0.70

Tested by

no test coverage detected