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

58 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""Quick demo: generate test data and verify it."""
import json
import os
# Create output directory
os.makedirs('/root/.hermes/wizard-outputs/spark', exist_ok=True)
# Generate test data
test_data = {
"task": "verification_demo",
"status": "complete",
"timestamp": "2026-10-18T00:00:00Z",
"items": [1, 2, 3, 4, 5],
"sum": 15
}
# Write the data file
data_path = '/root/.hermes/wizard-outputs/spark/test_data.json'
with open(data_path, 'w') as f:
json.dump(test_data, f, indent=2)
# Verify the data
with open(data_path, 'r') as f:
loaded = json.load(f)
# Perform verification checks
checks_passed = True
errors = []
if loaded['status'] != 'complete':
checks_passed = False
errors.append("status mismatch")
if loaded['sum'] != 15:
checks_passed = False
errors.append("sum mismatch")
if len(loaded['items']) != 5:
checks_passed = False
errors.append("items count mismatch")
# Write verification result
result = {
'passed': checks_passed,
'file': data_path,
'errors': errors if errors else None
}
result_path = '/root/.hermes/wizard-outputs/spark/verification_result.json'
with open(result_path, 'w') as f:
json.dump(result, f, indent=2)
print(f"Verification: {'PASSED' if checks_passed else 'FAILED'}")
print(f"Result file: {result_path}")
exit(0 if checks_passed else 1)