From 94b9e2217a448f268870c4a5a2d5df337bbff9ae Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 13 Jun 2026 18:00:14 -0400 Subject: [PATCH] test(ai_client): fix mocked gemini provider send function name to match implementation --- tests/test_ai_client_result.py | 10 +++++----- tests/test_deprecation_warnings.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_ai_client_result.py b/tests/test_ai_client_result.py index 4153fd2a..b25a10c6 100644 --- a/tests/test_ai_client_result.py +++ b/tests/test_ai_client_result.py @@ -6,7 +6,7 @@ from src.result_types import Result, ErrorInfo, ErrorKind def test_send_result_public_api_returns_result() -> None: with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="hello")) as mock_send: + with patch.object(ai_client, "_send_gemini", return_value=Result(data="hello")) as mock_send: r = ai_client.send_result("system", "user") assert isinstance(r, Result) assert r.ok @@ -18,7 +18,7 @@ def test_send_deprecated_emits_warning() -> None: 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_result", return_value=Result(data="hi")): + 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) @@ -27,7 +27,7 @@ def test_send_deprecated_emits_warning() -> None: def test_send_result_preserves_errors() -> None: err = ErrorInfo(kind=ErrorKind.RATE_LIMIT, message="slow down", source="test") with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="", errors=[err])): + with patch.object(ai_client, "_send_gemini", return_value=Result(data="", errors=[err])): r = ai_client.send_result("system", "user") assert not r.ok assert r.errors == [err] @@ -35,7 +35,7 @@ def test_send_result_preserves_errors() -> None: def test_send_extracts_data_from_result() -> None: with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="result text")): + with patch.object(ai_client, "_send_gemini", return_value=Result(data="result text")): result = ai_client.send("system", "user") assert result == "result text" @@ -43,7 +43,7 @@ def test_send_extracts_data_from_result() -> None: def test_send_returns_empty_string_on_error_result() -> 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_result", return_value=Result(data="", errors=[err])): + with patch.object(ai_client, "_send_gemini", return_value=Result(data="", errors=[err])): result = ai_client.send("system", "user") assert result == "" diff --git a/tests/test_deprecation_warnings.py b/tests/test_deprecation_warnings.py index e306af6e..dceb58c4 100644 --- a/tests/test_deprecation_warnings.py +++ b/tests/test_deprecation_warnings.py @@ -6,7 +6,7 @@ from src.result_types import Result def test_send_deprecated_warning_emitted_once_per_site() -> None: with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="x")): + with patch.object(ai_client, "_send_gemini", return_value=Result(data="x")): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") ai_client.send("s", "u") @@ -17,7 +17,7 @@ def test_send_deprecated_warning_emitted_once_per_site() -> None: def test_send_result_does_not_emit_deprecation() -> None: with patch.object(ai_client, "set_provider"): - with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="x")): + with patch.object(ai_client, "_send_gemini", return_value=Result(data="x")): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") ai_client.send_result("s", "u")