Files
troupe-standup/wizard-work/spark/verify_analyzer.py
T

51 lines
1.6 KiB
Python

#!/usr/bin/env python3
# Q63 (2026-10-24): no committed gate invokes this file -- `git grep -F -n verify_analyzer.py HEAD
# -- '*.py' '*.sh' CHECK` matches nothing outside this file -- so it is a one-off
# artifact, run by hand against its subject, not a standing check.
"""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)