diff options
| author | Anonymous Authors <anonymous@invalid.example> | 2026-07-24 13:24:36 -0500 |
|---|---|---|
| committer | Anonymous Authors <anonymous@invalid.example> | 2026-07-24 13:24:36 -0500 |
| commit | db293f3606a97b3e417de27124858e134005acbd (patch) | |
| tree | 8efeedcd2033b82d1c90eb0cb84e134421ff1a8f /tests/test_surface.py | |
Add minimal GAP reproduction package
Diffstat (limited to 'tests/test_surface.py')
| -rw-r--r-- | tests/test_surface.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_surface.py b/tests/test_surface.py new file mode 100644 index 0000000..78c4d5e --- /dev/null +++ b/tests/test_surface.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +import pytest + +from gap_pipeline.surface import ( + apply_rename_map, + create_surface_variant, + validate_rename_map, +) + + +def test_math_only_rename_preserves_english_article(item) -> None: + text = r"Let \(a\) be a randomly chosen value with \(a>0\)." + renamed = apply_rename_map(text, {"a": "coefalpha"}) + assert renamed == ( + r"Let \(coefalpha\) be a randomly chosen value with \(coefalpha>0\)." + ) + + +def test_surface_variant_changes_problem_and_solution(item) -> None: + variant = create_surface_variant( + item, + "descriptive_long", + {"a": "positiveScalar"}, + ) + assert "positiveScalar" in variant.problem + assert "positiveScalar" in variant.solution + assert "Let positiveScalar" not in variant.problem + + +def test_collision_and_nonbijection_are_rejected(item) -> None: + with pytest.raises(ValueError, match="collides"): + validate_rename_map( + {"a": "a"}, + existing_identifiers=["a"], + scientific_constants=[], + ) + with pytest.raises(ValueError, match="one-to-one"): + validate_rename_map( + {"a": "sharedName", "b": "sharedName"}, + existing_identifiers=["a", "b"], + scientific_constants=[], + ) |
