34 lines
927 B
Python
34 lines
927 B
Python
#!/usr/bin/env python3
|
|
"""Verification test for text_analyzer.py"""
|
|
import subprocess
|
|
import sys
|
|
|
|
# Run the analyzer
|
|
result = subprocess.run(
|
|
['python3', '/root/.hermes/wizard-outputs/spark/text_analyzer.py',
|
|
'/root/.hermes/wizard-outputs/spark/test_input.txt'],
|
|
capture_output=True, text=True
|
|
)
|
|
|
|
output = result.stdout.strip()
|
|
print("Analyzer output:")
|
|
print(output)
|
|
print()
|
|
|
|
# Verify against wc (ground truth)
|
|
lines = result.stdout.count('Lines: 1')
|
|
words = result.stdout.count('Words: 24')
|
|
chars = result.stdout.count('Characters: 125')
|
|
|
|
print(f"Lines check: {lines > 0}")
|
|
print(f"Words check: {words > 0}")
|
|
print(f"Chars check: {chars > 0}")
|
|
|
|
# Check exit code
|
|
assert result.returncode == 0, f"Expected exit code 0, got {result.returncode}"
|
|
assert lines > 0, "Missing Lines: 1"
|
|
assert words > 0, "Missing Words: 24"
|
|
assert chars > 0, "Missing Characters: 125"
|
|
|
|
print("\nAll verifications passed!")
|
|
sys.exit(0) |