(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
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Test the url_title_extractor module."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
from url_title_extractor import extract_title, TitleParser
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def test_title_parser():
|
|
"""Test basic HTML title extraction."""
|
|
parser = TitleParser()
|
|
parser.feed("<html><head><title>Python Testing</title></head><body>Content</body></html>")
|
|
assert parser.title == "Python Testing", f"Expected 'Python Testing', got '{parser.title}'"
|
|
return True
|
|
|
|
def test_extract_title():
|
|
"""Test URL title extraction."""
|
|
result = extract_title("https://example.com", use_cache=False)
|
|
return "title" in result or "error" in result
|
|
|
|
def test_cache_file_creation():
|
|
"""Test that cache file location is writable."""
|
|
cache_dir = Path(__file__).resolve().parent
|
|
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
return cache_dir.exists() and cache_dir.is_dir()
|
|
|
|
if __name__ == "__main__":
|
|
tests = [
|
|
("TitleParser", test_title_parser),
|
|
("Cache directory", test_cache_file_creation),
|
|
]
|
|
|
|
results = []
|
|
for name, test_fn in tests:
|
|
try:
|
|
passed = test_fn()
|
|
results.append({"test": name, "passed": passed, "error": None})
|
|
print(f"PASSED: {name}")
|
|
except Exception as e:
|
|
results.append({"test": name, "passed": False, "error": str(e)})
|
|
print(f"FAILED: {name} - {e}")
|
|
|
|
# Print summary
|
|
passed_count = sum(1 for r in results if r["passed"])
|
|
print(f"\nSummary: {passed_count}/{len(results)} tests passed")
|
|
sys.exit(0 if passed_count == len(results) else 1) |