| import json |
| from math_sanitizer import sanitize_math_ocr_hotfix |
| from orchestrator import select_best_anchor |
|
|
| def verify_v111_hotfix(): |
| print("🚀 Starting BuddyMath V1.1.1 Hotfix Verification") |
|
|
| |
| print("\n🧼 Testing Aggressive Sanitization:") |
| test_cases = [ |
| (" frac(x)(2)", "((x)/(2))"), |
| ("frac (x) ( 2 )", "((x)/(2))"), |
| ("\\left( x + 1 \\right)", "(x+1)") |
| ] |
| |
| for input_str, expected in test_cases: |
| result = sanitize_math_ocr_hotfix(input_str) |
| print(f" - '{input_str}' -> '{result}'") |
| assert result == expected or result == expected.replace(" ", ""), f"Sanitization mismatch: {result} != {expected}" |
| print(" ✅ Aggressive Sanitization - PASSED") |
|
|
| |
| print("\n⚓ Testing Smart Anchor Selection:") |
| candidates = ["f(x)=x", "f(x)=x^2+1", "f(x)=x^2"] |
| best = select_best_anchor(candidates) |
| print(f" - Best of {candidates} -> '{best}'") |
| assert best == "f(x)=x^2+1", "Smart anchor selection failed (longest policy)" |
| print(" ✅ Smart Anchor Selection - PASSED") |
|
|
| print("\n🏆 BuddyMath V1.1.1 Hotfix Verified!") |
|
|
| if __name__ == "__main__": |
| verify_v111_hotfix() |
|
|