Download tests/test_schema.py from 42e/mathcompose: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/42e/mathcompose/resolve/main/tests/test_schema.py
- Command line
-
hf download hf://42e/mathcompose/tests/test_schema.py
-
curl -L -o test_schema.py https://huggingface.co/42e/mathcompose/resolve/main/tests/test_schema.py
1.06 kB
| """Smoke #3: V output schema round-trip.""" | |
| from mathcompose.data.schema import ( | |
| StepVerdict, serialize_verifier_output, parse_verifier_output, | |
| ) | |
| def test_roundtrip_error(): | |
| sv = [StepVerdict(0, "correct", "fine"), StepVerdict(1, "incorrect", "sign error")] | |
| txt = serialize_verifier_output(sv, 1) | |
| out = parse_verifier_output(txt) | |
| assert out.first_error_index == 1 | |
| assert len(out.steps) == 2 | |
| assert not out.all_correct | |
| def test_roundtrip_all_correct(): | |
| sv = [StepVerdict(0, "correct", ""), StepVerdict(1, "correct", "")] | |
| out = parse_verifier_output(serialize_verifier_output(sv, -1)) | |
| assert out.first_error_index == -1 | |
| assert out.all_correct | |
| def test_parse_prefers_box_over_verdicts(): | |
| # box says 2 even though a verdict line marks paragraph 1 incorrect | |
| txt = "Paragraph 1: bad. Verdict: incorrect\n\n\\boxed{2}" | |
| assert parse_verifier_output(txt).first_error_index == 2 | |
| def test_parse_failure_sentinel(): | |
| assert parse_verifier_output("total nonsense with no structure").first_error_index == -2 | |