From dbdf9ba9e1c62e84a5bb22ac29089d69931f4898 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 13:52:38 -0400 Subject: [PATCH] test(llama_native): adapt 4 tests to Result API (doeh cleanup Phase 2.3) --- tests/test_llama_ollama_native.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_llama_ollama_native.py b/tests/test_llama_ollama_native.py index 068b212d..9cee2913 100644 --- a/tests/test_llama_ollama_native.py +++ b/tests/test_llama_ollama_native.py @@ -80,7 +80,7 @@ def test_send_llama_native_calls_ollama_chat_when_localhost() -> None: } with _mock_requests_with(mock_response): result = ai_client._send_llama_native("system", "user", ".", None, "", False, None, None, None) - assert "hi from native ollama" in result + assert result.ok and "hi from native ollama" in result.data def test_send_llama_native_preserves_thinking_field() -> None: """Ollama's 'thinking' field should be captured and rendered in the output.""" @@ -93,8 +93,8 @@ def test_send_llama_native_preserves_thinking_field() -> None: } with _mock_requests_with(mock_response): result = ai_client._send_llama_native("system", "user", ".", None, "", False, None, None, None) - assert "I thought about it" in result - assert "answer" in result + assert result.ok and "I thought about it" in result.data + assert "answer" in result.data def test_send_llama_routes_to_native_when_localhost() -> None: """The dispatcher in _send_llama must route localhost/127.0.0.1 to _send_llama_native.""" @@ -108,7 +108,7 @@ def test_send_llama_routes_to_native_when_localhost() -> None: with _mock_requests_with(mock_response), \ patch("src.ai_client._ensure_llama_client") as ensure: result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None) - assert "via native" in result + assert result.ok and "via native" in result.data assert not ensure.called, "_send_llama should NOT instantiate the openai client for native backend" def test_send_llama_keeps_openai_path_for_non_local() -> None: @@ -123,6 +123,6 @@ def test_send_llama_keeps_openai_path_for_non_local() -> None: with patch("src.ai_client._ensure_llama_client", return_value=mock_client) as ensure, \ _mock_requests_with(MagicMock(json=MagicMock(return_value={}))) as warm: result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None) - assert "via openrouter" in result + assert result.ok and "via openrouter" in result.data assert ensure.called assert not warm.return_value.post.called, "non-local backend must NOT hit Ollama's /api/chat"