diff --git a/README.md b/README.md index c5cd6f2..88a7209 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # PyMdown Extensions Blocks [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -![PyPI - Version](https://img.shields.io/pypi/v/pymdownx-blocks) +[![PyPI - Version](https://img.shields.io/pypi/v/pymdownx-blocks)](https://pypi.org/project/pymdownx-blocks/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pymdownx-blocks) -![Tests](https://img.shields.io/github/actions/workflow/status/TillerBurr/pymdownx-blocks/tests) +[![Tests](https://github.com/TillerBurr/pymdownx-blocks/workflows/tests/badge.svg)](https://github.com/TillerBurr/pymdownx-blocks/actions) diff --git a/pyproject.toml b/pyproject.toml index ec63f91..09f8bb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,19 @@ dependencies = [ "pyyaml>=6.0.1", ] readme = "README.md" -requires-python = ">= 3.12" +requires-python = ">= 3.8" +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", +] [build-system] requires = ["hatchling"] diff --git a/tests/conftest.py b/tests/conftest.py index 7e96429..52a89dd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,8 +6,9 @@ @pytest.fixture def markdown_fixture(): def _method( - extensions: list[str] | str, extension_config: dict[str : dict[str, Any]] + extensions: list[str] | str, extension_config: dict[str , dict[str, Any]] ): + """Fixture to dynamically insert markdown extensions.""" return markdown.Markdown( extensions=extensions, extension_configs=extension_config ) diff --git a/tests/test_dirtree.py b/tests/test_dirtree.py index d7d12bd..f77ea67 100644 --- a/tests/test_dirtree.py +++ b/tests/test_dirtree.py @@ -3,6 +3,7 @@ from pymdownx_blocks.dirtree import DirTree, InvalidTreeError, InvalidYAMLError from tests.utils import dedent, dedent_and_replace + root_dir_files = """ root_dir/: - file1 @@ -98,6 +99,7 @@ def generate_dirtree_input( placeholder: str, title: str | None = None, _type: str | None = None ): + """Generate input for testing. Wraps the tree in the expected block format.""" if title is None: title = "" else: @@ -120,6 +122,7 @@ def generate_dirtree_input( def generate_dirtree_expected( placeholder: str, title: str | None = None, _type: str | None = None ): + """Generate expected output. Wraps the tree in the expected block format.""" if title is None: title = "Directory Tree" if _type is None: @@ -148,7 +151,7 @@ def generate_dirtree_expected( def test_build(test_input, expected_output): dedent_in = dedent(test_input) dedent_out = dedent(expected_output) - assert DirTree(dedent_in).build() == dedent_out + assert DirTree(dedent_in).build_tree() == dedent_out def test_invalid_trees(): @@ -168,7 +171,7 @@ def test_invalid_yaml(): @pytest.mark.parametrize("class_type", ["note", "warning", "tip", "danger", None]) -@pytest.mark.parametrize("title", ["A Title", "AnotherTitle",None]) +@pytest.mark.parametrize("title", ["A Title", "AnotherTitle", None]) def test_title(markdown_fixture, class_type, title): md = markdown_fixture( ["pymdownx_blocks.dirtree"], extension_config={"pymdownx_blocks.dirtree": []} diff --git a/tests/utils.py b/tests/utils.py index ce68cec..3129626 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,13 +1,32 @@ import textwrap - def dedent(text: str) -> str: + """Dedent an indented string by the miniumum indentation level. + + Args: + text: String to dedent + + Returns: + dedented string + + """ return textwrap.dedent(text).strip("\n") def dedent_and_replace( to_dedent: str, to_replace: str, new: str, dedent_new: bool = True ) -> str: + """Dedent and replace a string. + + Args: + to_dedent: String to dedent + to_replace: String to replace + new: String to replace with + dedent_new: Bool that is true if `new` should also be dedented. + + Returns: + + """ if dedent_new: new = dedent(new) return dedent(to_dedent).replace(to_replace, new)