feat(ai_client): mark send() @deprecated; rewire to call send_result()
This commit is contained in:
@@ -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_anthropic_result", return_value=Result(data="hi")):
|
||||
with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="hi")):
|
||||
result = ai_client.send("system", "user")
|
||||
assert result == "hi"
|
||||
assert any(issubclass(x.category, DeprecationWarning) for x in w)
|
||||
@@ -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_anthropic_result", return_value=Result(data="result text")):
|
||||
with patch.object(ai_client, "_send_gemini_result", 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_anthropic_result", return_value=Result(data="", errors=[err])):
|
||||
with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="", errors=[err])):
|
||||
result = ai_client.send("system", "user")
|
||||
assert result == ""
|
||||
|
||||
|
||||
@@ -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_anthropic_result", return_value=Result(data="x")):
|
||||
with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="x")):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
ai_client.send("s", "u")
|
||||
|
||||
Reference in New Issue
Block a user