BuddyMath / tests /archive_scripts /verify_curriculum_compliance.py
dotandru's picture
Fix: Clean production deployment with sse-starlette
9d29c62
Raw
History Blame Contribute Delete
2.09 kB
# verify_curriculum_compliance.py
import asyncio
import sys
import os
# Add current directory to path
sys.path.append(os.getcwd())
from orchestrator import BuddyOrchestrator
from proof_graph import ProofStep, ProofGraph, validate_pedagogical_legality
import curriculum_engine
async def test_grade_7_violation():
print("🧪 Testing Grade 7 Violation (Equation Systems)...")
orchestrator = BuddyOrchestrator()
# Mock data: Grade 7 student
grade = "7"
level = "4"
problem_text = "פתור את מערכת המשוואות: x+y=10, x-y=2"
# 1. Fetch rules
rules = curriculum_engine.get_allowed_math_operators(grade, level)
print(f"📋 Rules for Grade 7: Forbidden={rules['forbidden']}")
# 2. Mock a "bad" ProofGraph that uses SYSTEM_OF_EQUATIONS
bad_steps = [
ProofStep(1, "x+y=10, x-y=2", "Original System"),
ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS")
]
bad_graph = ProofGraph(bad_steps)
# 3. Validate
is_legal, reason = validate_pedagogical_legality(bad_graph, rules)
if not is_legal:
print(f"✅ Success: Pedagogy Guard correctly REJECTED Grade 7 system solver. Reason: {reason}")
else:
print("❌ Failure: Pedagogy Guard ALLOWED forbidden operator.")
async def test_grade_8_allowed():
print("\n🧪 Testing Grade 8 Allowed (Equation Systems)...")
grade = "8"
rules = curriculum_engine.get_allowed_math_operators(grade)
steps = [
ProofStep(1, "x+y=10, x-y=2", "Original System"),
ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS")
]
graph = ProofGraph(steps)
is_legal, reason = validate_pedagogical_legality(graph, rules)
if is_legal:
print(f"✅ Success: Pedagogy Guard correctly ALLOWED Grade 8 system solver.")
else:
print(f"❌ Failure: Pedagogy Guard REJECTED allowed operator. Reason: {reason}")
if __name__ == "__main__":
asyncio.run(test_grade_7_violation())
asyncio.run(test_grade_8_allowed())