MCPcopy Index your code
hub / github.com/google/adk-python / _call_function_and_assert

Function _call_function_and_assert

tests/integration/test_context_variable.py:51–67  ·  view source on GitHub ↗
(
    agent_runner: TestRunner, function_name: str, params, expected
)

Source from the content-addressed store, hash-verified

49
50
51def _call_function_and_assert(
52 agent_runner: TestRunner, function_name: str, params, expected
53):
54 param_section = (
55 " with params"
56 f" {params if isinstance(params, str) else json.dumps(params)}"
57 if params is not None
58 else ""
59 )
60 agent_runner.run(
61 f"Call {function_name}{param_section} and show me the result"
62 )
63
64 model_response_event = agent_runner.get_events()[-1]
65 assert model_response_event.author == "context_variable_update_agent"
66 assert model_response_event.content.role == "model"
67 assert expected in model_response_event.content.parts[0].text.strip()

Callers 1

Calls 3

get_eventsMethod · 0.80
stripMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected