Private
Public Access
test(ai_client): rename send_result to send in 22 remaining test files
Batch rename of 22 test files. 62 references renamed total. The full test suite is now GREEN again, matching the pre-rename baseline from Task 1.1. Pure mechanical rename. No behavior change. Files affected: test_ai_cache_tracking, test_ai_client_cli, test_ai_client_result, test_api_events, test_context_pruner, test_deepseek_provider, test_gemini_cli_* (3 files), test_gui2_mcp, test_headless_* (2 files), test_live_gui_integration_v2, test_orchestration_logic, test_phase6_engine, test_rag_integration, test_run_worker_lifecycle_abort, test_spawn_interception_v2, test_symbol_parsing, test_tier4_interceptor, test_tiered_aggregation, test_token_usage. Note: spec estimated 24 files; actual is 22 (test_deprecation_warnings no longer exists, and 1 fewer file than spec's list). Refs: conductor/tracks/send_result_to_send_20260616/
This commit is contained in:
@@ -4,40 +4,40 @@ from src import ai_client
|
||||
from src.result_types import Result, ErrorInfo, ErrorKind
|
||||
|
||||
|
||||
def test_send_result_public_api_returns_result() -> None:
|
||||
def test_send_public_api_returns_result() -> None:
|
||||
with patch.object(ai_client, "set_provider"):
|
||||
with patch.object(ai_client, "_send_gemini", return_value=Result(data="hello")) as mock_send:
|
||||
r = ai_client.send_result("system", "user")
|
||||
r = ai_client.send("system", "user")
|
||||
assert isinstance(r, Result)
|
||||
assert r.ok
|
||||
assert r.data == "hello"
|
||||
|
||||
|
||||
def test_send_result_does_not_emit_deprecation() -> None:
|
||||
def test_send_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")):
|
||||
r = ai_client.send_result("system", "user")
|
||||
r = ai_client.send("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:
|
||||
def test_send_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", return_value=Result(data="", errors=[err])):
|
||||
r = ai_client.send_result("system", "user")
|
||||
r = ai_client.send("system", "user")
|
||||
assert not r.ok
|
||||
assert r.errors == [err]
|
||||
|
||||
|
||||
def test_send_result_returns_empty_data_with_error_on_auth_failure() -> None:
|
||||
def test_send_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])):
|
||||
r = ai_client.send_result("system", "user")
|
||||
r = ai_client.send("system", "user")
|
||||
assert not r.ok
|
||||
assert r.data == ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user