summaryrefslogtreecommitdiff
path: root/tests/test_models.py
diff options
context:
space:
mode:
authorAnonymous Authors <anonymous@invalid.example>2026-07-24 13:52:11 -0500
committerAnonymous Authors <anonymous@invalid.example>2026-07-24 13:52:11 -0500
commitd4eb26780a8a8c70ca75812af0c3c6a295c0797c (patch)
tree46d2aa0fca13f6db2c8226471981ce06c1423eac /tests/test_models.py
parentdb293f3606a97b3e417de27124858e134005acbd (diff)
Restore original GAP prompts and lock prompt bytes
Diffstat (limited to 'tests/test_models.py')
-rw-r--r--tests/test_models.py81
1 files changed, 25 insertions, 56 deletions
diff --git a/tests/test_models.py b/tests/test_models.py
index 2c678a0..71dc854 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -3,69 +3,38 @@ from __future__ import annotations
import pytest
from pydantic import ValidationError
-from gap_pipeline.models import (
- DiffusedProof,
- MethodPlan,
- ProofDAG,
- ReplacementSpec,
-)
+from gap_pipeline.models import JudgeVerdict, KernelCandidate, KernelPlan
-def test_valid_dag_and_plan(dag_dict: dict, plan_dict: dict) -> None:
- dag = ProofDAG.model_validate(dag_dict)
- assert [node.node_id for node in dag.topological_nodes()] == ["n1", "n2"]
- assert dag.leaf_node_ids() == ["n1"]
- plan = MethodPlan.model_validate(plan_dict)
- plan.validate_against(dag)
+def test_valid_plan_and_candidate(plan_dict: dict, candidate_dict: dict) -> None:
+ plan = KernelPlan.model_validate(plan_dict)
+ candidate = KernelCandidate.model_validate(candidate_dict)
+ assert len(plan.core_steps) == 2
+ assert candidate.question.startswith("Let x")
-def test_cycle_is_rejected(dag_dict: dict) -> None:
- dag_dict["nodes"][0]["dependencies"] = ["n2"]
- with pytest.raises(ValidationError, match="cycle"):
- ProofDAG.model_validate(dag_dict)
+def test_plan_requires_slots(plan_dict: dict) -> None:
+ plan_dict["mutable_slots"] = {}
+ with pytest.raises(ValidationError, match="mutable slot"):
+ KernelPlan.model_validate(plan_dict)
-def test_node_disconnected_from_terminal_is_rejected(dag_dict: dict) -> None:
- dag_dict["nodes"].append(
- {
- "node_id": "orphan",
- "claim": "unused claim",
- "derivation": "unused derivation",
- "dependencies": [],
- "source_span": "",
- "mathematical_objects": [],
- }
- )
- with pytest.raises(ValidationError, match="disconnected"):
- ProofDAG.model_validate(dag_dict)
+def test_plan_rejects_more_than_five_core_steps(plan_dict: dict) -> None:
+ plan_dict["core_steps"] = [f"step {index}" for index in range(6)]
+ with pytest.raises(ValidationError):
+ KernelPlan.model_validate(plan_dict)
-def test_method_reordering_is_rejected(dag_dict: dict, plan_dict: dict) -> None:
- dag = ProofDAG.model_validate(dag_dict)
- plan_dict["steps"].reverse()
- plan = MethodPlan.model_validate(plan_dict)
- with pytest.raises(ValueError, match="topological order"):
- plan.validate_against(dag)
+def test_candidate_requires_question_and_solution(candidate_dict: dict) -> None:
+ candidate_dict["solution"] = ""
+ with pytest.raises(ValidationError, match="non-empty"):
+ KernelCandidate.model_validate(candidate_dict)
-def test_replacement_must_target_leaf(
- dag_dict: dict, replacement_dict: dict
-) -> None:
- dag = ProofDAG.model_validate(dag_dict)
- replacement_dict["target_node_id"] = "n2"
- replacement = ReplacementSpec.model_validate(replacement_dict)
- with pytest.raises(ValueError, match="not a DAG leaf"):
- replacement.validate_against(dag)
-
-
-def test_diffusion_cannot_change_dag_dependencies(
- dag_dict: dict,
- plan_dict: dict,
- diffused_dict: dict,
-) -> None:
- dag = ProofDAG.model_validate(dag_dict)
- plan = MethodPlan.model_validate(plan_dict)
- diffused_dict["node_instantiations"][1]["dependencies"] = []
- diffused = DiffusedProof.model_validate(diffused_dict)
- with pytest.raises(ValueError, match="changes dependencies"):
- diffused.validate_against(dag, plan)
+def test_accept_verdict_cannot_report_blocking_issue() -> None:
+ with pytest.raises(ValidationError, match="cannot contain"):
+ JudgeVerdict(
+ verdict="accept",
+ step_by_step_check="checked",
+ blocking_issues="an error",
+ )