# tests/test_ce_fixes.py import asyncio import os import sys import logging import time # Add parent dir to path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from orchestrator import BuddyOrchestrator async def test_ce_fixes(): orchestrator = BuddyOrchestrator() # 03_ocr_only.jpeg is the target for geometry bypass and truth authority bypass check filename = "03_ocr_only.jpeg" filepath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "qa_golden_set", filename) if not os.path.exists(filepath): print(f"❌ File not found: {filepath}") return print(f"🔬 Testing CE Fixes with: {filename}...") with open(filepath, "rb") as f: image_data = f.read() start_time = time.time() try: result = await orchestrator.solve_problem( problem_text="[CE_FIXES_TEST]", grade="י'", student_name="QA_BOT", image_data=image_data ) duration = time.time() - start_time logic_error = result.get("logic_error", False) error_type = result.get("error_type", "NONE") if logic_error: print(f"❌ FAILED: logic_error=True, error_type={error_type}") print(f"Final Answer: {result.get('final_answer')}") else: print(f"✅ SUCCESS! (Duration: {duration:.1f}s)") print(f"Final Answer: {result.get('final_answer')[:100]}...") sections = result.get("sections", []) print(f"Sections found: {len(sections)}") except Exception as e: print(f"💥 CRASH: {e}") if __name__ == "__main__": asyncio.run(test_ce_fixes())