Every expected article survives under a distinct folded slug, its body is the one generated for it, and every inline link target exists on disk.
(root: Path, expected_headings: set[str])
| 391 | |
| 392 | |
| 393 | def _assert_wiki_complete(root: Path, expected_headings: set[str]) -> None: |
| 394 | """Every expected article survives under a distinct folded slug, its body is |
| 395 | the one generated for it, and every inline link target exists on disk.""" |
| 396 | files = sorted(p.name for p in root.glob("*.md")) |
| 397 | articles = [p for p in root.glob("*.md") if p.name != "index.md"] |
| 398 | assert len(articles) == len(expected_headings), files |
| 399 | assert len({p.stem.casefold() for p in articles}) == len(articles), files |
| 400 | headings = {p.read_text(encoding="utf-8").splitlines()[0] for p in articles} |
| 401 | assert headings == {f"# {label}" for label in expected_headings}, headings |
| 402 | for md in root.glob("*.md"): |
| 403 | for display, target in _inline_links(md.read_text(encoding="utf-8")): |
| 404 | assert (root / target).exists(), f"{md.name}: [{display}] -> {target} is dead" |
| 405 | |
| 406 | |
| 407 | @pytest.mark.parametrize("labels", _UNICODE_FOLD_PAIRS, ids=["german-sharp-s", "greek-sigma"]) |
no test coverage detected