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

24 lines
758 B
Python

#!/usr/bin/env python3
"""Verify CSV output is valid."""
import csv
import json
# Verify CSV is valid
with open('/root/.hermes/wizard-outputs/spark/output.csv', 'r') as f:
reader = csv.DictReader(f)
rows = list(reader)
assert len(rows) == 2, f"Expected 2 rows, got {len(rows)}"
assert 'name' in rows[0], "Missing 'name' column"
assert rows[0]['name'] == 'Alice Smith', f"Wrong name: {rows[0]['name']}"
# Verify the JSON source was correctly processed
with open('/root/.hermes/wizard-outputs/spark/sample_data.json', 'r') as f:
source = json.load(f)
assert len(source) == 2, "Source JSON should have 2 records"
print("PASS: CSV is valid with correct data structure")
print(f"Records: {len(rows)}")
print(f"Columns: {sorted(rows[0].keys())}")