Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Dec 23, 2024
1 parent 796b27e commit e7977a8
Show file tree
Hide file tree
Showing 92 changed files with 175 additions and 410 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ dev-dependencies = [
]

[tool.inline-snapshot]
snapshot-dir = "tests/snapshots"
storage-dir = "tests/snapshots"
513 changes: 166 additions & 347 deletions tests/snapshots/__init__.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/snapshots/external/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore all snapshots which are not refered in the source
*-new.*
68 changes: 6 additions & 62 deletions tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,62 +17,6 @@
from mkdocstrings.handlers.python import PythonHandler


options: dict[str, Any] = {
# General options.
"find_stubs_package": (True, False),
"allow_inspection": (True, False),
"show_bases": (True, False),
"show_source": (True, False),
"preload_modules": ((), ("mod1",), None),
# Heading options.
"heading_level": (1, 2, 3, 4, 5, 6),
"show_root_heading": (True, False),
"show_root_toc_entry": (True, False),
"show_root_full_path": (True, False),
"show_root_members_full_path": (True, False),
"show_object_full_path": (True, False),
"show_category_heading": (True, False),
"show_symbol_type_heading": (True, False),
"show_symbol_type_toc": (True, False),
# Members options.
"inherited_members": ((), ("method1",), True, False),
"members": ((), ("module_attribute",), True, False, None),
"members_order": ("source", "alphabetical"),
"filters": ((), ("!module_attribute",), ("module_attribute",), None),
"group_by_category": (True, False),
"show_submodules": (True, False),
"summary": (True, False), # TODO: Test dict.
"show_labels": (True, False),
# Docstrings options.
"docstring_style": ("numpy", "google", "sphinx", None),
"docstring_options": ({},), # TODO: Add more examples.
"docstring_section_style": ("table", "list", "spacy"),
"merge_init_into_class": (True, False),
"show_if_no_docstring": (True, False),
"show_docstring_attributes": (True, False),
"show_docstring_functions": (True, False),
"show_docstring_classes": (True, False),
"show_docstring_modules": (True, False),
"show_docstring_description": (True, False),
"show_docstring_examples": (True, False),
"show_docstring_other_parameters": (True, False),
"show_docstring_parameters": (True, False),
"show_docstring_raises": (True, False),
"show_docstring_receives": (True, False),
"show_docstring_returns": (True, False),
"show_docstring_warns": (True, False),
"show_docstring_yields": (True, False),
# Signature options.
"annotations_path": ("brief", "source", "full"),
"line_length": (0, 1, 10, 60, 120, 1000),
"show_signature": (True, False),
"show_signature_annotations": (True, False),
"signature_crossrefs": (True, False),
"separate_signature": (True, False),
"unwrap_annotated": (True, False),
}


def _normalize_html(html: str) -> str:
soup = bs4.BeautifulSoup(html, features="html.parser")
html = soup.prettify()
Expand Down Expand Up @@ -105,9 +49,9 @@ def _render_options(options: dict[str, Any]) -> str:


# Signature options
@pytest.mark.parametrize("show_signature_annotations", options["show_signature_annotations"])
@pytest.mark.parametrize("signature_crossrefs", options["signature_crossrefs"])
@pytest.mark.parametrize("separate_signature", options["separate_signature"])
@pytest.mark.parametrize("show_signature_annotations", [True, False])
@pytest.mark.parametrize("signature_crossrefs", [True, False])
@pytest.mark.parametrize("separate_signature", [True, False])
def test_end_to_end_for_signatures(
session_handler: PythonHandler,
show_signature_annotations: bool,
Expand Down Expand Up @@ -144,9 +88,9 @@ def method1(self, a: int, b: str) -> None:


# Members options.
@pytest.mark.parametrize("inherited_members", options["inherited_members"])
@pytest.mark.parametrize("members", options["members"])
@pytest.mark.parametrize("filters", options["filters"])
@pytest.mark.parametrize("inherited_members", [(), ("method1",), True, False])
@pytest.mark.parametrize("members", [(), ("module_attribute",), True, False, None])
@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), None])
def test_end_to_end_for_members(
session_handler: PythonHandler,
inherited_members: list[str] | bool | None,
Expand Down

0 comments on commit e7977a8

Please sign in to comment.