This commit was merged in pull request #190.
This commit is contained in:
@@ -98,35 +98,35 @@ class TestGetOllamaModelExactMatch:
|
||||
|
||||
@patch("timmy.tools_intro.httpx.get")
|
||||
def test_prefix_collision_returns_correct_model(self, mock_get):
|
||||
"""qwen3:30b configured — must NOT match qwen3.5:latest (prefix bug)."""
|
||||
"""qwen3:8b configured — must NOT match qwen3:30b (prefix bug)."""
|
||||
from timmy.tools_intro import _get_ollama_model
|
||||
|
||||
# /api/ps has both models loaded; configured is qwen3:30b
|
||||
ps_resp = _mock_response({"models": [{"name": "qwen3.5:latest"}, {"name": "qwen3:30b"}]})
|
||||
# /api/ps has both models loaded; configured is qwen3:8b
|
||||
ps_resp = _mock_response({"models": [{"name": "qwen3:30b"}, {"name": "qwen3:8b"}]})
|
||||
mock_get.return_value = ps_resp
|
||||
|
||||
with patch("config.settings") as mock_settings:
|
||||
mock_settings.ollama_model = "qwen3:30b"
|
||||
mock_settings.ollama_model = "qwen3:8b"
|
||||
mock_settings.ollama_url = "http://localhost:11434"
|
||||
result = _get_ollama_model()
|
||||
|
||||
assert result == "qwen3:30b", f"Got '{result}' — prefix collision bug!"
|
||||
assert result == "qwen3:8b", f"Got '{result}' — prefix collision bug!"
|
||||
|
||||
@patch("timmy.tools_intro.httpx.get")
|
||||
def test_configured_model_not_running_returns_actual(self, mock_get):
|
||||
"""If configured model isn't loaded, report what IS running."""
|
||||
from timmy.tools_intro import _get_ollama_model
|
||||
|
||||
ps_resp = _mock_response({"models": [{"name": "qwen3.5:latest"}]})
|
||||
ps_resp = _mock_response({"models": [{"name": "qwen3:30b"}]})
|
||||
mock_get.return_value = ps_resp
|
||||
|
||||
with patch("config.settings") as mock_settings:
|
||||
mock_settings.ollama_model = "qwen3:30b"
|
||||
mock_settings.ollama_model = "qwen3:8b"
|
||||
mock_settings.ollama_url = "http://localhost:11434"
|
||||
result = _get_ollama_model()
|
||||
|
||||
# Should report actual running model, not configured one
|
||||
assert result == "qwen3.5:latest"
|
||||
assert result == "qwen3:30b"
|
||||
|
||||
@patch("timmy.tools_intro.httpx.get")
|
||||
def test_latest_suffix_match(self, mock_get):
|
||||
|
||||
Reference in New Issue
Block a user