mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 01:41:25 -06:00

Copybara import of the project: -- ade1d98e030a966183f56cb5c9c1b04cf51f5337 by Thiago Neves <thiagohneves@gmail.com>: fix(tests): use mock GCS client in artifact service tests to avoid real credentials -- becd2925feebf60196129b029a0ab8d490f7b19e by Thiago Neves <thiagohneves@gmail.com>: test(agents): add unit tests for live_request_queue, readonly_context, and run_config COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/641 from thiagoneves:feature/increase-test-coverage 0f7a9fc55d97902e190a394f099324fbeb1541af PiperOrigin-RevId: 756798390
32 lines
926 B
Python
32 lines
926 B
Python
import pytest
|
|
import sys
|
|
import logging
|
|
from unittest.mock import patch, ANY
|
|
from google.adk.agents.run_config import RunConfig
|
|
|
|
|
|
def test_validate_max_llm_calls_valid():
|
|
value = RunConfig.validate_max_llm_calls(100)
|
|
assert value == 100
|
|
|
|
|
|
def test_validate_max_llm_calls_negative():
|
|
with patch("google.adk.agents.run_config.logger.warning") as mock_warning:
|
|
value = RunConfig.validate_max_llm_calls(-1)
|
|
mock_warning.assert_called_once_with(ANY)
|
|
assert value == -1
|
|
|
|
|
|
def test_validate_max_llm_calls_warns_on_zero():
|
|
with patch("google.adk.agents.run_config.logger.warning") as mock_warning:
|
|
value = RunConfig.validate_max_llm_calls(0)
|
|
mock_warning.assert_called_once_with(ANY)
|
|
assert value == 0
|
|
|
|
|
|
def test_validate_max_llm_calls_too_large():
|
|
with pytest.raises(
|
|
ValueError, match=f"max_llm_calls should be less than {sys.maxsize}."
|
|
):
|
|
RunConfig.validate_max_llm_calls(sys.maxsize)
|