from __future__ import annotations import copy import pytest from gap_pipeline.models import CanonicalItem @pytest.fixture def item() -> CanonicalItem: return CanonicalItem( item_id="demo-A-1", problem=r"Let \(a>0\). Prove that \(a+1/a\ge 2\).", solution=( r"Since \((a-1)^2\ge0\), expanding gives \(a^2-2a+1\ge0\). " r"Divide by \(a>0\) to obtain \(a+1/a\ge2\)." ), variables=["a"], problem_type="proof", ) @pytest.fixture def plan_dict() -> dict: return { "core_steps": [ "use nonnegativity of a square", "expand and divide by a positive quantity", ], "mutable_slots": { "slot1": { "description": "the positive reference value", "original": "1", } }, } @pytest.fixture def candidate_dict() -> dict: return { "question": "Let x>0. Prove that x+4/x >= 4.", "solution": ( "Since (x-2)^2 >= 0, expand and divide by x>0 " "to get x+4/x >= 4." ), } def changed_candidate(candidate: dict, suffix: str) -> dict: value = copy.deepcopy(candidate) value["question"] = value["question"] + f" [{suffix}]" value["solution"] = value["solution"] + f" Repair {suffix}." return value