| """Tests for HTML gallery export.""" | |
| from __future__ import annotations | |
| from pathlib import Path | |
| from mathvision_explorer.dataset import MathVisionRecord | |
| from mathvision_explorer.html import export_html | |
| def test_export_html_writes_gallery(tmp_path: Path) -> None: | |
| """HTML export includes record metadata and question text.""" | |
| output = tmp_path / "gallery.html" | |
| records = [ | |
| MathVisionRecord( | |
| problem_id="demo-1", | |
| question="How many squares?", | |
| answer="4", | |
| subject="counting", | |
| level=1, | |
| ) | |
| ] | |
| export_html(records, output) | |
| html = output.read_text(encoding="utf-8") | |
| assert "MathVision Explorer" in html | |
| assert "How many squares?" in html | |
| assert "demo-1" in html | |