#!/usr/bin/env python3 import runpy import tempfile import unittest from pathlib import Path _audit = runpy.run_path(str(Path(__file__).with_name("aeo_audit.py"))) _matrix = runpy.run_path(str(Path(__file__).with_name("build_prompt_matrix.py"))) audit = _audit["audit"] build = _matrix["build"] class AeoScriptTests(unittest.TestCase): def test_audit_finds_answer_structure_and_jsonld(self): html = """
Mesh networks route traffic between peers.
""" with tempfile.NamedTemporaryFile("w", suffix=".html", encoding="utf-8", delete=False) as handle: handle.write(html) path = handle.name result = audit(path) self.assertEqual(result["h1_count"], 1) self.assertEqual(result["question_heading_count"], 2) self.assertEqual(result["jsonld_types"], ["Article"]) Path(path).unlink() def test_audit_reports_parse_error_without_claiming_success(self): with tempfile.NamedTemporaryFile("w", suffix=".html", encoding="utf-8", delete=False) as handle: handle.write("