summaryrefslogtreecommitdiff
path: root/tests/test_surface.py
diff options
context:
space:
mode:
authorOscar Wan <oscarwan@stanford.edu>2026-07-24 20:45:42 -0700
committerOscar Wan <oscarwan@stanford.edu>2026-07-24 20:45:42 -0700
commit15efc30e9e7179accd30375d3edb2e34a3b4dc5f (patch)
treeba1c49eb128e7906ba451141723d763e1dcda53a /tests/test_surface.py
parent708f2af9c6985e9cb5cd53e434a7d3b8dfa2b4ac (diff)
updated generation process
Diffstat (limited to 'tests/test_surface.py')
-rw-r--r--tests/test_surface.py37
1 files changed, 34 insertions, 3 deletions
diff --git a/tests/test_surface.py b/tests/test_surface.py
index 4d92de3..5f38d57 100644
--- a/tests/test_surface.py
+++ b/tests/test_surface.py
@@ -6,7 +6,11 @@ import pytest
from gap_pipeline.clients import ScriptedClient
from gap_pipeline.store import RunStore
-from gap_pipeline.surface import SurfacePipeline, validate_surface_variant
+from gap_pipeline.surface import (
+ SurfacePipeline,
+ apply_rename_map,
+ validate_surface_variant,
+)
def test_surface_pipeline_uses_full_original_contract(tmp_path, item) -> None:
@@ -25,8 +29,15 @@ def test_surface_pipeline_uses_full_original_contract(tmp_path, item) -> None:
).run_family(item, "descriptive_long")
)
assert variant.rename_map == {"a": "positivequantity"}
- assert variant.question == response["question"]
- assert variant.solution == response["solution"]
+ assert variant.question == apply_rename_map(
+ item.problem, {"a": "positivequantity"}
+ )
+ assert variant.solution == apply_rename_map(
+ item.solution, {"a": "positivequantity"}
+ )
+ assert "that" in variant.question
+ assert "expand" in variant.solution
+ assert "obtain" in variant.solution
def test_missing_symbol_and_nonbijection_are_rejected(item) -> None:
@@ -56,3 +67,23 @@ def test_original_identifier_contract_is_enforced(item) -> None:
question="question",
solution="solution",
)
+
+
+def test_surface_text_must_be_only_a_token_safe_rename(item) -> None:
+ rename_map = {"a": "positivequantity"}
+ question = apply_rename_map(item.problem, rename_map)
+ solution = apply_rename_map(item.solution, rename_map)
+ validate_surface_variant(
+ item,
+ rename_map=rename_map,
+ question=question,
+ solution=solution,
+ )
+
+ with pytest.raises(ValueError, match="exact deterministic rename"):
+ validate_surface_variant(
+ item,
+ rename_map=rename_map,
+ question=question + " Extra text.",
+ solution=solution,
+ )