Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/test_llm_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ def test_empty_narrative_section_is_flagged(analyzer):
assert "Analysis unavailable" in results["executive_summary"]


def test_empty_zeroday_response_records_an_error(analyzer):
anomaly = ZeroDayAnomaly(detector="d", title="t", score=90, description="desc")
with patch(
"urllib.request.urlopen", side_effect=lambda *a, **k: _FakeResponse(_claude_text(""))
):
results = analyzer._analyze_zeroday([anomaly])

assert len(results) == 1
assert "raw_analysis" not in results[0]
assert "empty response" in results[0]["error"]


def test_analyze_single_finding_propagates_failure(analyzer):
with patch("urllib.request.urlopen", side_effect=_http_error(401)):
with pytest.raises(LLMError):
Expand Down