Files
troupe-standup/wizard-work/spark/test_validator.py
T
ledger b14d73a8f4 volt: Q126 -- gate 9/9: nine host-bound test files rebound to the repo module, 225 census paths ledgered
(a) import-resolve: 9 OUTSIDE_REPO faults -> 0 over 138 graded files. The eight
lanes' test files now insert str(Path(__file__).resolve().parent) and resolve
their data paths from __file__; test_hermes.py is rewritten as the host probe it
always was (skills root from HERMES_SKILLS_DIR/HERMES_HOME/~/.hermes/skills, rc 0
found / 77 SKIP / 1 FAIL) instead of binding a module that does not exist.
Falsified: poisoning the repo copy reds the rebound test (rc 1) and leaves HEAD's
host-bound copy green (rc 0), both restored.

(b) path-claims: 225 new -> 0. All 225 came from sol's untracked-file census; each
was measured (0 add-commits on any ref, present on disk untracked, listed verbatim
in the census) and is a NOT_ADDED row under a batch note. One CLEARED row dropped
(spark/lwc_counter.py, resurrected at 3e667eb after Q125 retired it).

Carried in, not authored here: tools/verify.py's ninth leg and the two-line Q98
record (Sentinel's Q98 artifact), so HEAD agrees with Q98's own text.

verify --repo .: 9 legs, 9 pass, 0 fault -- gate OK. Report:
/root/.hermes/wizard-outputs/volt/2026-10-30-q126.md
2026-10-30 05:37:30 +00:00

44 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Test runner for json_schema_cli.py"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from json_schema_cli import validate_data, load_json
print("=" * 50)
print("JSON Schema Validator Tests")
print("=" * 50)
# Load test schema
schema = load_json(str(Path(__file__).resolve().parent / 'test_schema.json'))
# Test 1: Valid data
print("\nTest 1: Valid data")
valid_data = load_json(str(Path(__file__).resolve().parent / 'valid_test_data.json'))
errors = validate_data(valid_data, schema)
print(f" Data: {valid_data}")
print(f" Errors: {errors}")
print(f" Valid: {len(errors) == 0}")
assert len(errors) == 0, "Valid data should pass"
# Test 2: Invalid data (age is string)
print("\nTest 2: Invalid data")
invalid_data = load_json(str(Path(__file__).resolve().parent / 'invalid_test_data.json'))
errors = validate_data(invalid_data, schema)
print(f" Data: {invalid_data}")
print(f" Errors: {errors}")
print(f" Valid: {len(errors) == 0}")
assert len(errors) > 0, "Invalid data should fail"
# Test 3: Missing required field
print("\nTest 3: Missing required field")
missing_field = {"name": "Charlie"} # Missing age
errors = validate_data(missing_field, schema)
print(f" Data: {missing_field}")
print(f" Errors: {errors}")
assert len(errors) > 0, "Missing required field should fail"
print("\n" + "=" * 50)
print("All tests PASSED!")
print("=" * 50)