mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
test: Add test to ensure RunConfig instances do not share audio transcription configs
The new test verifies that `output_audio_transcription` and `input_audio_transcription` attributes are unique to each `RunConfig` instance, preventing unintended side effects from modifying one instance. PiperOrigin-RevId: 806405671
This commit is contained in:
committed by
Copybara-Service
parent
05e3f73451
commit
168c724866
@@ -1,4 +1,17 @@
|
||||
import logging
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
from unittest.mock import ANY
|
||||
from unittest.mock import patch
|
||||
@@ -31,3 +44,23 @@ def test_validate_max_llm_calls_too_large():
|
||||
ValueError, match=f"max_llm_calls should be less than {sys.maxsize}."
|
||||
):
|
||||
RunConfig.validate_max_llm_calls(sys.maxsize)
|
||||
|
||||
|
||||
def test_audio_transcription_configs_are_not_shared_between_instances():
|
||||
config1 = RunConfig()
|
||||
config2 = RunConfig()
|
||||
|
||||
# Validate output_audio_transcription
|
||||
assert config1.output_audio_transcription is not None
|
||||
assert config2.output_audio_transcription is not None
|
||||
assert (
|
||||
config1.output_audio_transcription
|
||||
is not config2.output_audio_transcription
|
||||
)
|
||||
|
||||
# Validate input_audio_transcription
|
||||
assert config1.input_audio_transcription is not None
|
||||
assert config2.input_audio_transcription is not None
|
||||
assert (
|
||||
config1.input_audio_transcription is not config2.input_audio_transcription
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user