diff --git a/wizard-work/spark/verify_analyzer.py b/wizard-work/spark/verify_analyzer.py new file mode 100644 index 0000000..2f8143a --- /dev/null +++ b/wizard-work/spark/verify_analyzer.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +"""Verification script to check number_analyzer.py output is correct.""" + +import subprocess +import json +import sys + +def verify(): + """Run number_analyzer.py and verify output is correct.""" + result = subprocess.run( + ["python3", "/root/.hermes/wizard-outputs/spark/number_analyzer.py"], + capture_output=True, + text=True + ) + + if result.returncode != 0: + print(f"FAIL: Script returned non-zero exit code: {result.returncode}") + return False + + try: + output = json.loads(result.stdout.strip()) + except json.JSONDecodeError as e: + print(f"FAIL: Output is not valid JSON: {e}") + return False + + # Expected values for 42 + expected = { + "value": 42, + "is_prime": False, + "is_even": True, + "fizz_buzz": "fizz" # 42 divisible by 3, not by 5 or 15 + } + + # Verify each field + for key, expected_val in expected.items(): + if key not in output: + print(f"FAIL: Missing key '{key}' in output") + return False + if output[key] != expected_val: + print(f"FAIL: {key} expected {expected_val}, got {output[key]}") + return False + + print("PASS: All verifications succeeded") + return True + +if __name__ == "__main__": + success = verify() + sys.exit(0 if success else 1) \ No newline at end of file