mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
test: Add tests for Runner initialization constraints
These tests verify that `ValueError` is raised when `Runner` is initialized without providing either an `app` instance or both `app_name` and `agent`. PiperOrigin-RevId: 805427256
This commit is contained in:
committed by
Copybara-Service
parent
0935a40011
commit
7148e0e82e
@@ -442,6 +442,30 @@ class TestRunnerWithPlugins:
|
||||
artifact_service=self.artifact_service,
|
||||
)
|
||||
|
||||
def test_runner_init_raises_error_without_app_and_app_name(self):
|
||||
"""Test ValueError is raised when app is not provided and app_name is missing."""
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match="Either app or both app_name and agent must be provided.",
|
||||
):
|
||||
Runner(
|
||||
agent=self.root_agent,
|
||||
session_service=self.session_service,
|
||||
artifact_service=self.artifact_service,
|
||||
)
|
||||
|
||||
def test_runner_init_raises_error_without_app_and_agent(self):
|
||||
"""Test ValueError is raised when app is not provided and agent is missing."""
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match="Either app or both app_name and agent must be provided.",
|
||||
):
|
||||
Runner(
|
||||
app_name="test_app",
|
||||
session_service=self.session_service,
|
||||
artifact_service=self.artifact_service,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__])
|
||||
|
||||
Reference in New Issue
Block a user