mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-19 11:52:19 -06:00
Move public_utils to utils in tests
Renamed conflicting utils.py as testing_utils.py PiperOrigin-RevId: 761715808
This commit is contained in:
committed by
Copybara-Service
parent
09cb128cf9
commit
41b33d4a0a
@@ -27,7 +27,7 @@ from google.genai import types
|
||||
from pydantic import BaseModel
|
||||
import pytest
|
||||
|
||||
from .. import utils
|
||||
from .. import testing_utils
|
||||
|
||||
|
||||
class CallbackType(Enum):
|
||||
@@ -42,7 +42,9 @@ async def mock_async_before_cb_side_effect(
|
||||
):
|
||||
if ret_value:
|
||||
return LlmResponse(
|
||||
content=utils.ModelContent([types.Part.from_text(text=ret_value)])
|
||||
content=testing_utils.ModelContent(
|
||||
[types.Part.from_text(text=ret_value)]
|
||||
)
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -54,7 +56,9 @@ def mock_sync_before_cb_side_effect(
|
||||
):
|
||||
if ret_value:
|
||||
return LlmResponse(
|
||||
content=utils.ModelContent([types.Part.from_text(text=ret_value)])
|
||||
content=testing_utils.ModelContent(
|
||||
[types.Part.from_text(text=ret_value)]
|
||||
)
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -66,7 +70,9 @@ async def mock_async_after_cb_side_effect(
|
||||
):
|
||||
if ret_value:
|
||||
return LlmResponse(
|
||||
content=utils.ModelContent([types.Part.from_text(text=ret_value)])
|
||||
content=testing_utils.ModelContent(
|
||||
[types.Part.from_text(text=ret_value)]
|
||||
)
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -78,7 +84,9 @@ def mock_sync_after_cb_side_effect(
|
||||
):
|
||||
if ret_value:
|
||||
return LlmResponse(
|
||||
content=utils.ModelContent([types.Part.from_text(text=ret_value)])
|
||||
content=testing_utils.ModelContent(
|
||||
[types.Part.from_text(text=ret_value)]
|
||||
)
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -129,7 +137,7 @@ async def test_before_model_callbacks_chain(
|
||||
expected_calls: List[int],
|
||||
):
|
||||
responses = ["model_response"]
|
||||
mock_model = utils.MockModel.create(responses=responses)
|
||||
mock_model = testing_utils.MockModel.create(responses=responses)
|
||||
|
||||
mock_cbs = []
|
||||
for response, callback_type in callbacks:
|
||||
@@ -154,9 +162,9 @@ async def test_before_model_callbacks_chain(
|
||||
before_model_callback=[mock_cb for mock_cb in mock_cbs],
|
||||
)
|
||||
|
||||
runner = utils.TestInMemoryRunner(agent)
|
||||
runner = testing_utils.TestInMemoryRunner(agent)
|
||||
result = await runner.run_async_with_new_session("test")
|
||||
assert utils.simplify_events(result) == [
|
||||
assert testing_utils.simplify_events(result) == [
|
||||
("root_agent", expected_response),
|
||||
]
|
||||
|
||||
@@ -191,7 +199,7 @@ async def test_after_model_callbacks_chain(
|
||||
expected_calls: List[int],
|
||||
):
|
||||
responses = ["model_response"]
|
||||
mock_model = utils.MockModel.create(responses=responses)
|
||||
mock_model = testing_utils.MockModel.create(responses=responses)
|
||||
|
||||
mock_cbs = []
|
||||
for response, callback_type in callbacks:
|
||||
@@ -216,9 +224,9 @@ async def test_after_model_callbacks_chain(
|
||||
after_model_callback=[mock_cb for mock_cb in mock_cbs],
|
||||
)
|
||||
|
||||
runner = utils.TestInMemoryRunner(agent)
|
||||
runner = testing_utils.TestInMemoryRunner(agent)
|
||||
result = await runner.run_async_with_new_session("test")
|
||||
assert utils.simplify_events(result) == [
|
||||
assert testing_utils.simplify_events(result) == [
|
||||
("root_agent", expected_response),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user