(
agent_runner: TestRunner, function_name: str, params, expected
)
| 49 | |
| 50 | |
| 51 | def _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() |
no test coverage detected