File size: 774 Bytes
3e67073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""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