(self)
| 1160 | self.assertIn(expected_line, as_text) |
| 1161 | |
| 1162 | def test_long_signatures(self): |
| 1163 | from collections.abc import Callable |
| 1164 | from typing import Literal, Annotated |
| 1165 | |
| 1166 | class A: |
| 1167 | def __init__(self, |
| 1168 | arg1: Callable[[int, int, int], str], |
| 1169 | arg2: Literal['some value', 'other value'], |
| 1170 | arg3: Annotated[int, 'some docs about this type'], |
| 1171 | ) -> None: |
| 1172 | ... |
| 1173 | |
| 1174 | doc = pydoc.render_doc(A) |
| 1175 | doc = clean_text(doc) |
| 1176 | self.assertEqual(doc, '''Python Library Documentation: class A in module %s |
| 1177 | |
| 1178 | class A(builtins.object) |
| 1179 | | A( |
| 1180 | | arg1: Callable[[int, int, int], str], |
| 1181 | | arg2: Literal['some value', 'other value'], |
| 1182 | | arg3: Annotated[int, 'some docs about this type'] |
| 1183 | | ) -> None |
| 1184 | | |
| 1185 | | Methods defined here: |
| 1186 | | |
| 1187 | | __init__( |
| 1188 | | self, |
| 1189 | | arg1: Callable[[int, int, int], str], |
| 1190 | | arg2: Literal['some value', 'other value'], |
| 1191 | | arg3: Annotated[int, 'some docs about this type'] |
| 1192 | | ) -> None |
| 1193 | | |
| 1194 | | ---------------------------------------------------------------------- |
| 1195 | | Data descriptors defined here: |
| 1196 | | |
| 1197 | | __dict__%s |
| 1198 | | |
| 1199 | | __weakref__%s |
| 1200 | ''' % (__name__, |
| 1201 | '' if MISSING_C_DOCSTRINGS else '\n | dictionary for instance variables', |
| 1202 | '' if MISSING_C_DOCSTRINGS else '\n | list of weak references to the object', |
| 1203 | )) |
| 1204 | |
| 1205 | def func( |
| 1206 | arg1: Callable[[Annotated[int, 'Some doc']], str], |
| 1207 | arg2: Literal[1, 2, 3, 4, 5, 6, 7, 8], |
| 1208 | ) -> Annotated[int, 'Some other']: |
| 1209 | ... |
| 1210 | |
| 1211 | doc = pydoc.render_doc(func) |
| 1212 | doc = clean_text(doc) |
| 1213 | self.assertEqual(doc, '''Python Library Documentation: function func in module %s |
| 1214 | |
| 1215 | func( |
| 1216 | arg1: Callable[[Annotated[int, 'Some doc']], str], |
| 1217 | arg2: Literal[1, 2, 3, 4, 5, 6, 7, 8] |
| 1218 | ) -> Annotated[int, 'Some other'] |
| 1219 | ''' % __name__) |
nothing calls this directly
no test coverage detected