diff --git a/tests/test_ai_client_result.py b/tests/test_ai_client_result.py index b25a10c6..170dca22 100644 --- a/tests/test_ai_client_result.py +++ b/tests/test_ai_client_result.py @@ -13,15 +13,15 @@ def test_send_result_public_api_returns_result() -> None: assert r.data == "hello" -def test_send_deprecated_emits_warning() -> None: +def test_send_result_does_not_emit_deprecation() -> None: import warnings with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") with patch.object(ai_client, "set_provider"): with patch.object(ai_client, "_send_gemini", return_value=Result(data="hi")): - result = ai_client.send("system", "user") - assert result == "hi" - assert any(issubclass(x.category, DeprecationWarning) for x in w) + r = ai_client.send_result("system", "user") + assert r.ok and r.data == "hi" + assert not any(issubclass(x.category, DeprecationWarning) for x in w) def test_send_result_preserves_errors() -> None: @@ -33,19 +33,13 @@ def test_send_result_preserves_errors() -> None: assert r.errors == [err] -def test_send_extracts_data_from_result() -> None: - with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini", return_value=Result(data="result text")): - result = ai_client.send("system", "user") - assert result == "result text" - - -def test_send_returns_empty_string_on_error_result() -> None: +def test_send_result_returns_empty_data_with_error_on_auth_failure() -> None: err = ErrorInfo(kind=ErrorKind.AUTH, message="bad key", source="test") with patch.object(ai_client, "set_provider"): with patch.object(ai_client, "_send_gemini", return_value=Result(data="", errors=[err])): - result = ai_client.send("system", "user") - assert result == "" + r = ai_client.send_result("system", "user") + assert not r.ok + assert r.data == "" def test_classify_gemini_error_returns_error_info() -> None: