Files
timmy-home/tests/test_burn_lane_issue_audit.py
2026-04-15 21:20:44 -04:00

70 lines
2.1 KiB
Python

from pathlib import Path
from scripts.burn_lane_issue_audit import extract_issue_numbers, render_report
def test_extract_issue_numbers_handles_ranges_and_literals() -> None:
body = """
| #579 | CLOSED |
| #660-658 | Benchmark reports |
| #582, #627, #631 | Know Thy Father phases |
| #547-545 | Fleet progression |
"""
assert extract_issue_numbers(body) == [579, 660, 659, 658, 582, 627, 631, 547, 546, 545]
def test_render_report_calls_out_drift_and_candidates() -> None:
rows = [
{
"number": 579,
"title": "heartbeat",
"state": "closed",
"classification": "already_closed",
"pr_summary": "closed via merged PR #701",
},
{
"number": 648,
"title": "session harvest report",
"state": "open",
"classification": "closure_candidate",
"pr_summary": "merged PR #702",
},
{
"number": 645,
"title": "still active",
"state": "open",
"classification": "needs_manual_review",
"pr_summary": "no matching PR found",
},
]
report = render_report(
source_issue=662,
source_title="Burn lane empty",
referenced_rows=rows,
generated_at="2026-04-16T01:00:00Z",
)
assert "## Issue Body Drift" in report
assert "## Closure Candidates" in report
assert "#648" in report
assert "merged PR #702" in report
assert "#645" in report
assert "needs manual review" in report.lower()
def test_burn_lane_report_file_exists_with_required_sections() -> None:
text = Path("reports/production/2026-04-16-burn-lane-empty-audit.md").read_text(encoding="utf-8")
required = [
"# Burn Lane Empty Audit — timmy-home #662",
"## Source Snapshot",
"## Live Summary",
"## Issue Body Drift",
"## Closure Candidates",
"## Still Open / Needs Manual Review",
]
missing = [item for item in required if item not in text]
assert not missing, missing