@@ -22,12 +22,16 @@ def load_fixture(name: str) -> dict:
2222
2323
2424class TestAnthropicBackend :
25+ """Tests for the Anthropic LLM backend."""
26+
2527 def test_instantiates_with_config (self ):
28+ """Test that the backend can be instantiated with a valid configuration."""
2629 cfg = LLMConfig (provider = "anthropic" , model = "claude-sonnet-4-6" , api_key = "test-key" )
2730 backend = AnthropicBackend (cfg )
2831 assert isinstance (backend , AnthropicBackend )
2932
3033 def test_complete_returns_string (self ):
34+ """Test that the complete method returns a string response."""
3135 fixture = load_fixture ("anthropic_triage_response.json" )
3236 cfg = LLMConfig (provider = "anthropic" , model = "claude-sonnet-4-6" , api_key = "test-key" )
3337 backend = AnthropicBackend (cfg )
@@ -43,6 +47,7 @@ def test_complete_returns_string(self):
4347 assert result == fixture ["content" ]
4448
4549 def test_complete_with_system_prompt (self ):
50+ """Test that the complete method correctly handles a system prompt."""
4651 cfg = LLMConfig (provider = "anthropic" , model = "claude-sonnet-4-6" , api_key = "test-key" )
4752 backend = AnthropicBackend (cfg )
4853
@@ -58,6 +63,7 @@ def test_complete_with_system_prompt(self):
5863 assert any (m .get ("role" ) == "system" for m in messages )
5964
6065 def test_complete_passes_model_to_litellm (self ):
66+ """Test that the correct model name is passed to the underlying LiteLLM call."""
6167 cfg = LLMConfig (provider = "anthropic" , model = "claude-sonnet-4-6" , api_key = "test-key" )
6268 backend = AnthropicBackend (cfg )
6369
@@ -73,12 +79,16 @@ def test_complete_passes_model_to_litellm(self):
7379
7480
7581class TestOllamaBackend :
82+ """Tests for the Ollama LLM backend."""
83+
7684 def test_instantiates_with_config (self ):
85+ """Test that the backend can be instantiated with a valid configuration."""
7786 cfg = LLMConfig (provider = "ollama" , model = "llama3" )
7887 backend = OllamaBackend (cfg )
7988 assert isinstance (backend , OllamaBackend )
8089
8190 def test_complete_returns_string (self ):
91+ """Test that the complete method returns a string response."""
8292 fixture = load_fixture ("ollama_triage_response.json" )
8393 cfg = LLMConfig (provider = "ollama" , model = "llama3" )
8494 backend = OllamaBackend (cfg )
@@ -94,6 +104,7 @@ def test_complete_returns_string(self):
94104 assert result == fixture ["content" ]
95105
96106 def test_complete_with_system_prompt (self ):
107+ """Test that the complete method correctly handles a system prompt."""
97108 cfg = LLMConfig (provider = "ollama" , model = "llama3" )
98109 backend = OllamaBackend (cfg )
99110
@@ -108,6 +119,7 @@ def test_complete_with_system_prompt(self):
108119 assert any (m .get ("role" ) == "system" for m in messages )
109120
110121 def test_complete_passes_ollama_model_format (self ):
122+ """Test that the model name is passed to LiteLLM in the expected Ollama format."""
111123 cfg = LLMConfig (provider = "ollama" , model = "llama3" )
112124 backend = OllamaBackend (cfg )
113125
0 commit comments