feat: add xhtmlmp renderer

This commit is contained in:
randogoth 2026-09-26 12:41:09 +03:00
parent 3ed0b5807c
commit 3af44fb0ac
14 changed files with 524 additions and 7 deletions

View file

@ -11,7 +11,7 @@ from xml.etree import ElementTree
import pytest
from conftest import EXAMPLES, GOLDEN, render_file
from golden_cases import CASES, MULTI_CASES
from golden_cases import CASES, MULTI_CASES, XHTMLMP_CASES
REGENERATE_HINT = (
@ -49,6 +49,20 @@ def test_golden_files_are_well_formed(path):
ElementTree.fromstring(path.read_text(encoding="utf-8"))
@pytest.mark.parametrize("name", sorted(XHTMLMP_CASES))
def test_matches_golden_xhtmlmp(name):
source, options = XHTMLMP_CASES[name]
golden = GOLDEN / f"{name}.xhtml"
assert golden.exists(), f"missing golden for '{name}'; {REGENERATE_HINT}"
actual = render_file(EXAMPLES / source, renderer_name="xhtmlmp", **options)
assert actual == golden.read_text(encoding="utf-8"), REGENERATE_HINT
@pytest.mark.parametrize("path", sorted(GOLDEN.glob("**/*.xhtml")), ids=lambda p: p.name)
def test_xhtmlmp_golden_files_are_well_formed(path):
ElementTree.fromstring(path.read_text(encoding="utf-8"))
def test_every_example_has_a_case():
"""A new examples/*.md without a golden case would go unverified."""
covered = {source for source, _ in list(CASES.values()) + list(MULTI_CASES.values())}