wapdown/tests/golden_cases.py
2026-09-26 13:08:50 +03:00

43 lines
1.9 KiB
Python

"""The set of (source, options) -> golden file cases.
Shared by `test_golden.py` and `regenerate_golden.py` so the suite and the
regeneration script can never disagree about what should exist.
"""
from __future__ import annotations
from typing import Any, Dict, Tuple
# name -> (example filename, renderer options)
CASES: Dict[str, Tuple[str, Dict[str, Any]]] = {
"trail": ("trail.md", {}),
"trail-split": ("trail.md", {"split_level": 2}),
"trail-linear": ("trail.md", {"split_level": 2, "menu": False}),
"trail-manual": ("trail-manual.md", {}),
"trail-select": ("trail-manual.md", {"menu_style": "select"}),
"trail-home": ("trail-manual.md", {"home_label": "Home"}),
"trail-no-template": ("trail-manual.md", {"template_nav": False}),
"trail-paginated": ("trail-manual.md", {"max_card_bytes": 120}),
"trail-images-alt": ("trail-manual.md", {"images": "alt"}),
"trail-head": ("trail-manual.md", {"cache_control": 0, "access_domain": "example.com"}),
"trail-rules": ("trail-rules.md", {}),
"trail-rules-linear": ("trail-rules.md", {"menu": False}),
"trail-rules-kept": ("trail-rules.md", {"split_on_rule": False}),
"kitchen-sink": ("kitchen-sink.md", {}),
}
# Cases that produce several files; each is written to its own directory.
MULTI_CASES: Dict[str, Tuple[str, Dict[str, Any]]] = {
"trail-decks": ("trail-manual.md", {"deck_per_card": True, "home_label": "Home"}),
}
# name -> (example filename, renderer options), rendered through the
# XHTML-MP renderer. A separate table from CASES because XHTML-MP output is
# a plain string, not a DeckOutput -- there is no deck/card topology to
# vary, so only options that affect ordinary block/inline rendering apply.
XHTMLMP_CASES: Dict[str, Tuple[str, Dict[str, Any]]] = {
"trail-xhtmlmp": ("trail.md", {}),
"trail-manual-xhtmlmp": ("trail-manual.md", {}),
"trail-rules-xhtmlmp": ("trail-rules.md", {}),
"kitchen-sink-xhtmlmp": ("kitchen-sink.md", {}),
}