diff --git a/tests/test_llm_analyzer.py b/tests/test_llm_analyzer.py index c713d7d..9dba071 100644 --- a/tests/test_llm_analyzer.py +++ b/tests/test_llm_analyzer.py @@ -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):