|
17 | 17 | from mkdocstrings.handlers.python import PythonHandler
|
18 | 18 |
|
19 | 19 |
|
20 |
| -options: dict[str, Any] = { |
21 |
| - # General options. |
22 |
| - "find_stubs_package": (True, False), |
23 |
| - "allow_inspection": (True, False), |
24 |
| - "show_bases": (True, False), |
25 |
| - "show_source": (True, False), |
26 |
| - "preload_modules": ((), ("mod1",), None), |
27 |
| - # Heading options. |
28 |
| - "heading_level": (1, 2, 3, 4, 5, 6), |
29 |
| - "show_root_heading": (True, False), |
30 |
| - "show_root_toc_entry": (True, False), |
31 |
| - "show_root_full_path": (True, False), |
32 |
| - "show_root_members_full_path": (True, False), |
33 |
| - "show_object_full_path": (True, False), |
34 |
| - "show_category_heading": (True, False), |
35 |
| - "show_symbol_type_heading": (True, False), |
36 |
| - "show_symbol_type_toc": (True, False), |
37 |
| - # Members options. |
38 |
| - "inherited_members": ((), ("method1",), True, False), |
39 |
| - "members": ((), ("module_attribute",), True, False, None), |
40 |
| - "members_order": ("source", "alphabetical"), |
41 |
| - "filters": ((), ("!module_attribute",), ("module_attribute",), None), |
42 |
| - "group_by_category": (True, False), |
43 |
| - "show_submodules": (True, False), |
44 |
| - "summary": (True, False), # TODO: Test dict. |
45 |
| - "show_labels": (True, False), |
46 |
| - # Docstrings options. |
47 |
| - "docstring_style": ("numpy", "google", "sphinx", None), |
48 |
| - "docstring_options": ({},), # TODO: Add more examples. |
49 |
| - "docstring_section_style": ("table", "list", "spacy"), |
50 |
| - "merge_init_into_class": (True, False), |
51 |
| - "show_if_no_docstring": (True, False), |
52 |
| - "show_docstring_attributes": (True, False), |
53 |
| - "show_docstring_functions": (True, False), |
54 |
| - "show_docstring_classes": (True, False), |
55 |
| - "show_docstring_modules": (True, False), |
56 |
| - "show_docstring_description": (True, False), |
57 |
| - "show_docstring_examples": (True, False), |
58 |
| - "show_docstring_other_parameters": (True, False), |
59 |
| - "show_docstring_parameters": (True, False), |
60 |
| - "show_docstring_raises": (True, False), |
61 |
| - "show_docstring_receives": (True, False), |
62 |
| - "show_docstring_returns": (True, False), |
63 |
| - "show_docstring_warns": (True, False), |
64 |
| - "show_docstring_yields": (True, False), |
65 |
| - # Signature options. |
66 |
| - "annotations_path": ("brief", "source", "full"), |
67 |
| - "line_length": (0, 1, 10, 60, 120, 1000), |
68 |
| - "show_signature": (True, False), |
69 |
| - "show_signature_annotations": (True, False), |
70 |
| - "signature_crossrefs": (True, False), |
71 |
| - "separate_signature": (True, False), |
72 |
| - "unwrap_annotated": (True, False), |
73 |
| -} |
74 |
| - |
75 |
| - |
76 | 20 | def _normalize_html(html: str) -> str:
|
77 | 21 | soup = bs4.BeautifulSoup(html, features="html.parser")
|
78 | 22 | html = soup.prettify()
|
@@ -105,9 +49,9 @@ def _render_options(options: dict[str, Any]) -> str:
|
105 | 49 |
|
106 | 50 |
|
107 | 51 | # Signature options
|
108 |
| -@pytest.mark.parametrize("show_signature_annotations", options["show_signature_annotations"]) |
109 |
| -@pytest.mark.parametrize("signature_crossrefs", options["signature_crossrefs"]) |
110 |
| -@pytest.mark.parametrize("separate_signature", options["separate_signature"]) |
| 52 | +@pytest.mark.parametrize("show_signature_annotations", [True, False]) |
| 53 | +@pytest.mark.parametrize("signature_crossrefs", [True, False]) |
| 54 | +@pytest.mark.parametrize("separate_signature", [True, False]) |
111 | 55 | def test_end_to_end_for_signatures(
|
112 | 56 | session_handler: PythonHandler,
|
113 | 57 | show_signature_annotations: bool,
|
@@ -144,9 +88,9 @@ def method1(self, a: int, b: str) -> None:
|
144 | 88 |
|
145 | 89 |
|
146 | 90 | # Members options.
|
147 |
| -@pytest.mark.parametrize("inherited_members", options["inherited_members"]) |
148 |
| -@pytest.mark.parametrize("members", options["members"]) |
149 |
| -@pytest.mark.parametrize("filters", options["filters"]) |
| 91 | +@pytest.mark.parametrize("inherited_members", [(), ("method1",), True, False]) |
| 92 | +@pytest.mark.parametrize("members", [(), ("module_attribute",), True, False, None]) |
| 93 | +@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), None]) |
150 | 94 | def test_end_to_end_for_members(
|
151 | 95 | session_handler: PythonHandler,
|
152 | 96 | inherited_members: list[str] | bool | None,
|
|
0 commit comments