26 lines
789 B
Python
26 lines
789 B
Python
"""Capture the public Chinese report opening used by the Markdown export tests."""
|
|
|
|
from pathlib import Path
|
|
import re
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
for directory in (ROOT, ROOT / "scripts"):
|
|
sys.path.insert(0, str(directory))
|
|
|
|
from tests.public_chart_reports import PUBLIC_REPORT_CASES, public_chart_reports
|
|
|
|
|
|
FIXTURE = ROOT / "frontend/tests/fixtures/report-export-20261111/jobs-head-zh.md"
|
|
|
|
|
|
def public_report_head() -> str:
|
|
_, chinese, _ = public_chart_reports(PUBLIC_REPORT_CASES[0])
|
|
headings = list(re.finditer(r"^## ", chinese, re.MULTILINE))
|
|
return chinese[:headings[1].start()].rstrip() + "\n"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
FIXTURE.parent.mkdir(parents=True, exist_ok=True)
|
|
FIXTURE.write_bytes(public_report_head().encode("utf-8"))
|