MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _assert_wiki_complete

Function _assert_wiki_complete

tests/test_wiki.py:393–404  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

391
392
393def _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"])

Calls 1

_inline_linksFunction · 0.70

Tested by

no test coverage detected