diff --git a/tests/test_qwen_provider.py b/tests/test_qwen_provider.py index ee14eebc..91311a20 100644 --- a/tests/test_qwen_provider.py +++ b/tests/test_qwen_provider.py @@ -1,6 +1,7 @@ from unittest.mock import MagicMock, patch import pytest from src import ai_client +from src.result_types import Result @pytest.fixture(autouse=True) def _reset_qwen_state(): @@ -15,7 +16,7 @@ def test_send_qwen_routes_to_dashscope(monkeypatch: pytest.MonkeyPatch) -> None: with patch("src.ai_client._ensure_qwen_client") as ensure, \ patch("src.ai_client._dashscope_call", return_value={"text": "hi from qwen", "tool_calls": [], "usage": {"input_tokens": 10, "output_tokens": 5}}) as call: result = ai_client._send_qwen("system", "user", ".", None, "", False, None, None, None) - assert result == "hi from qwen" + assert result.ok and result.data == "hi from qwen" call.assert_called_once() ensure.assert_called_once() @@ -25,7 +26,7 @@ def test_qwen_vision_vl_model_accepts_image(monkeypatch: pytest.MonkeyPatch) -> patch("src.ai_client._dashscope_call", return_value={"text": "I see a cat", "tool_calls": [], "usage": {"input_tokens": 10, "output_tokens": 5}}) as call: file_items = [{"path": "/tmp/cat.png", "is_image": True, "base64_data": "iVBOR..."}] result = ai_client._send_qwen("system", "describe this image", ".", file_items, "", False, None, None, None) - assert "cat" in result.lower() + assert result.ok and "cat" in result.data.lower() kwargs = call.call_args.kwargs msgs_str = str(kwargs.get("messages", [])).lower() assert "image" in msgs_str or "cat.png" in msgs_str