diff --git a/python/tests/integration/test_awesome_nav.py b/python/tests/integration/test_awesome_nav.py index 501b42c..a71358d 100644 --- a/python/tests/integration/test_awesome_nav.py +++ b/python/tests/integration/test_awesome_nav.py @@ -106,9 +106,7 @@ nav: "---\ntitle: Guide landing\n---\n# Overview\n", encoding="utf-8" ) (guide / "start.md").write_text("# Start\n", encoding="utf-8") - (guide / "draft.hidden.md").write_text( - "# Hidden\n", encoding="utf-8" - ) + (guide / "draft.hidden.md").write_text("# Hidden\n", encoding="utf-8") (guide / ".nav.yml").write_text( """\ use_index_title: true @@ -361,9 +359,7 @@ def test_natural_sort_matches_upstream_numeric_and_grouped_case_order( (docs / name).write_text( f'---\ntitle: "{title}"\n---\n# Page\n', encoding="utf-8" ) - (docs / ".nav.yml").write_text( - "sort:\n by: title\n", encoding="utf-8" - ) + (docs / ".nav.yml").write_text("sort:\n by: title\n", encoding="utf-8") zensical.build(str(_write_config(tmp_path)), _BUILD_OPTIONS) @@ -391,9 +387,7 @@ def test_deep_explicit_directory_resolves_before_its_parent( _write_template(tmp_path) (docs / "foo" / "foo.md").write_text("# Foo\n", encoding="utf-8") (nested / "bar.md").write_text("# Bar\n", encoding="utf-8") - (docs / ".nav.yml").write_text( - "nav: [foo, foo/bar]\n", encoding="utf-8" - ) + (docs / ".nav.yml").write_text("nav: [foo, foo/bar]\n", encoding="utf-8") zensical.build(str(_write_config(tmp_path)), _BUILD_OPTIONS) @@ -476,9 +470,7 @@ def test_serve_rebuilds_navigation_after_control_file_edit( stderr=subprocess.STDOUT, ) - def wait_for( - condition: Callable[[], bool], timeout: float = 10.0 - ) -> None: + def wait_for(condition: Callable[[], bool], timeout: float = 10.0) -> None: deadline = time.monotonic() + timeout while time.monotonic() < deadline: if condition(): @@ -500,9 +492,7 @@ def test_serve_rebuilds_navigation_after_control_file_edit( with navigation.open("r+", encoding="utf-8") as stream: stream.write("nav: [other.md]\n") stream.truncate() - wait_for( - lambda: _items_or_none(tmp_path) == [(0, "Other", "other/")] - ) + wait_for(lambda: _items_or_none(tmp_path) == [(0, "Other", "other/")]) assert process.poll() is None finally: process.terminate() @@ -523,9 +513,7 @@ def test_awesome_nav_replaces_literate_nav_and_rejects_extglobs( _write_template(tmp_path) (docs / "index.md").write_text("# Home\n", encoding="utf-8") (docs / "other.md").write_text("# Other\n", encoding="utf-8") - (docs / "SUMMARY.md").write_text( - "* [Other](other.md)\n", encoding="utf-8" - ) + (docs / "SUMMARY.md").write_text("* [Other](other.md)\n", encoding="utf-8") navigation = docs / ".nav.yml" navigation.write_text("nav: [index.md]\n", encoding="utf-8") config = _write_config(tmp_path, "awesome-nav\n - literate-nav") diff --git a/python/tests/integration/test_literate_nav.py b/python/tests/integration/test_literate_nav.py index c9652ca..301905a 100644 --- a/python/tests/integration/test_literate_nav.py +++ b/python/tests/integration/test_literate_nav.py @@ -89,12 +89,8 @@ def test_resolves_markers_nested_files_wildcards_and_external_links( """, encoding="utf-8", ) - (docs / "guide" / "index.md").write_text( - "# Overview\n", encoding="utf-8" - ) - (docs / "guide" / "start.md").write_text( - "# Start\n", encoding="utf-8" - ) + (docs / "guide" / "index.md").write_text("# Overview\n", encoding="utf-8") + (docs / "guide" / "start.md").write_text("# Start\n", encoding="utf-8") (docs / "guide" / "advanced.md").write_text( "# Advanced\n", encoding="utf-8" ) @@ -135,9 +131,7 @@ def test_resolves_configured_directory_through_nested_literate_nav( guide.mkdir(parents=True) _write_template(tmp_path) (docs / "index.md").write_text("# Home\n", encoding="utf-8") - (guide / "SUMMARY.md").write_text( - "* [Start](start.md)\n", encoding="utf-8" - ) + (guide / "SUMMARY.md").write_text("* [Start](start.md)\n", encoding="utf-8") (guide / "start.md").write_text("# Start\n", encoding="utf-8") config = tmp_path / "mkdocs.yml" config.write_text( @@ -284,9 +278,7 @@ def test_directory_wildcards_do_not_consume_files(tmp_path: Path) -> None: section = docs / "section2" section.mkdir(parents=True) _write_template(tmp_path) - (docs / "SUMMARY.md").write_text( - "- */\n- *.md\n", encoding="utf-8" - ) + (docs / "SUMMARY.md").write_text("- */\n- *.md\n", encoding="utf-8") (docs / "item1.md").write_text("# Item 1\n", encoding="utf-8") (docs / "item2.md").write_text("# Item 2\n", encoding="utf-8") (section / "item.md").write_text("# Section item\n", encoding="utf-8") diff --git a/python/tests/integration/test_meta.py b/python/tests/integration/test_meta.py index da7b5ae..54c04f0 100644 --- a/python/tests/integration/test_meta.py +++ b/python/tests/integration/test_meta.py @@ -71,7 +71,7 @@ plugins: zensical.build(str(config), _BUILD_OPTIONS) - output = (tmp_path / "site" / "guide" / "page" / "index.html") + output = tmp_path / "site" / "guide" / "page" / "index.html" assert json.loads(output.read_text()) == { "items": ["root", "guide", "page"], "scope": {"guide": "guide", "page": "page", "root": "root"}, diff --git a/python/tests/integration/test_minify.py b/python/tests/integration/test_minify.py index d333c49..a0de575 100644 --- a/python/tests/integration/test_minify.py +++ b/python/tests/integration/test_minify.py @@ -71,9 +71,7 @@ plugins: def test_minifies_final_html_and_inline_languages(tmp_path: Path) -> None: """HTML runs last while script/style use parser-backed minifiers.""" - zensical.build( - str(_project(tmp_path)), {"clean": False, "strict": False} - ) + zensical.build(str(_project(tmp_path)), {"clean": False, "strict": False}) output = (tmp_path / "site" / "index.html").read_text() assert "remove this comment" not in output @@ -101,9 +99,7 @@ def test_inline_minification_does_not_require_html_minification( assert "screen and (min-width:45em)" in output -def _asset_project( - root: Path, *, minify: bool, cache_safe: bool -) -> Path: +def _asset_project(root: Path, *, minify: bool, cache_safe: bool) -> Path: """Create a project covering exact, glob, and configured assets.""" docs = root / "docs" (docs / "assets" / "nested").mkdir(parents=True) @@ -293,9 +289,7 @@ def _unminified_asset_project(root: Path) -> Path: (docs / "assets").mkdir(parents=True) (overrides / "assets").mkdir(parents=True) (docs / "index.md").write_text("# Assets\n", encoding="utf-8") - (docs / "assets" / "shared.txt").write_text( - "project\n", encoding="utf-8" - ) + (docs / "assets" / "shared.txt").write_text("project\n", encoding="utf-8") (overrides / "assets" / "shared.txt").write_text( "theme\n", encoding="utf-8" ) diff --git a/python/tests/integration/test_redirects.py b/python/tests/integration/test_redirects.py index a851ebf..c628af1 100644 --- a/python/tests/integration/test_redirects.py +++ b/python/tests/integration/test_redirects.py @@ -60,19 +60,12 @@ def test_redirects_generate_mkdocs_compatible_artifacts(tmp_path: Path) -> None: zensical.build(str(config), _BUILD_OPTIONS) old = (tmp_path / "site" / "old" / "index.html").read_text() - nested = ( - tmp_path / "site" / "legacy" / "deep" / "index.html" - ).read_text() - external = ( - tmp_path / "site" / "external" / "index.html" - ).read_text() + nested = (tmp_path / "site" / "legacy" / "deep" / "index.html").read_text() + external = (tmp_path / "site" / "external" / "index.html").read_text() assert '' in old + assert '' in nested assert ( - '' in nested - ) - assert ( - '' - in external + '' in external ) assert "noindex" not in old @@ -98,8 +91,7 @@ def test_missing_redirect_target_warns_and_strict_mode_fails( zensical.build(str(config), _BUILD_OPTIONS) assert not (tmp_path / "site" / "old" / "index.html").exists() assert ( - "Redirect target 'missing.md' does not exist!" - in capfd.readouterr().err + "Redirect target 'missing.md' does not exist!" in capfd.readouterr().err ) with pytest.raises(RuntimeError, match="strict flag is set"): @@ -240,9 +232,11 @@ def test_serve_removes_and_restores_redirect_with_its_target( wait_for(lambda: not output.exists()) target.write_text("# New again\n", encoding="utf-8") wait_for( - lambda: output.is_file() - and target_output.is_file() - and "New again" in target_output.read_text(encoding="utf-8") + lambda: ( + output.is_file() + and target_output.is_file() + and "New again" in target_output.read_text(encoding="utf-8") + ) ) assert process.poll() is None finally: diff --git a/python/tests/integration/test_search.py b/python/tests/integration/test_search.py index e73d3c4..d84e6bf 100644 --- a/python/tests/integration/test_search.py +++ b/python/tests/integration/test_search.py @@ -167,9 +167,7 @@ Not indexed. disabled = tmp_path / "disabled" disabled.mkdir() - config = _write_project( - disabled, plugins=" search:\n enabled: false" - ) + config = _write_project(disabled, plugins=" search:\n enabled: false") zensical.build(str(config), _BUILD_OPTIONS) assert _read_index(disabled)["items"] == [] diff --git a/python/tests/unit/extensions/test_autorefs.py b/python/tests/unit/extensions/test_autorefs.py index 2a07f83..2d356d9 100644 --- a/python/tests/unit/extensions/test_autorefs.py +++ b/python/tests/unit/extensions/test_autorefs.py @@ -536,9 +536,7 @@ class TestHeadingsTreeprocessor: def test_register_heading(self, md: Markdown) -> None: """A single heading is registered under its toc-generated slug.""" md.convert("## Foo") - assert get_autorefs_page_data("page")["primary"]["foo"] == [ - "page#foo" - ] + assert get_autorefs_page_data("page")["primary"]["foo"] == ["page#foo"] @pytest.mark.parametrize( "md",