Skip to content

Add tests for render_report empty-evidence and Timeline branches #38

Description

@shauryagangrade

Summary

Add tests for the currently-uncovered branches of render_report in src/intent_alignment/report.py.

Why

render_report is the library's primary human-readable output, but two branches are never exercised (0% coverage per a local run):

  • Empty evidencereport.py:41: lines.append(" No evidence collected.") when report.evidence is empty.
  • Timeline sectionreport.py:62-66: rendered only when report.timeline is non-empty; the engine always produces timeline=[] (engine.py:118), so the Timeline block is currently dead code.

Both are simple to construct directly since AlignmentReport is a plain dataclass (src/intent_alignment/models.py:28-37).

Suggested approach

Add tests/unit/test_report.py:

def test_render_report_empty_evidence():
    report = AlignmentReport(overall_alignment=50.0, confidence=40.0, status="Moderate_Drift",
                             breakdown={}, summary="s", evidence=[], risk="r",
                             recommendation="rec", timeline=[])
    out = render_report(report)
    assert "No evidence collected." in out

def test_render_report_timeline():
    report = AlignmentReport(overall_alignment=50.0, confidence=40.0, status="Moderate_Drift",
                             breakdown={}, summary="s", evidence=[], risk="r",
                             recommendation="rec",
                             timeline=[{"stage": "day-1", "score": 80.0}])
    out = render_report(report)
    assert "Timeline" in out
    assert "day-1" in out

Also cover _evidence_marker thresholds (value >= 0.7, >= 0.4, else) and _format_status if convenient.

Acceptance criteria

  • Both branches and the marker/format helpers are covered.
  • pytest tests/ passes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstestingIssues and improvements for the test suite

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions