| """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(): |
| |
| 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 |
|
|