Skip to content

Commit 168c724

Browse files
hangfeicopybara-github
authored andcommitted
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
1 parent 05e3f73 commit 168c724

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/unittests/agents/test_run_config.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
import logging
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
215
import sys
316
from unittest.mock import ANY
417
from unittest.mock import patch
@@ -31,3 +44,23 @@ def test_validate_max_llm_calls_too_large():
3144
ValueError, match=f"max_llm_calls should be less than {sys.maxsize}."
3245
):
3346
RunConfig.validate_max_llm_calls(sys.maxsize)
47+
48+
49+
def test_audio_transcription_configs_are_not_shared_between_instances():
50+
config1 = RunConfig()
51+
config2 = RunConfig()
52+
53+
# Validate output_audio_transcription
54+
assert config1.output_audio_transcription is not None
55+
assert config2.output_audio_transcription is not None
56+
assert (
57+
config1.output_audio_transcription
58+
is not config2.output_audio_transcription
59+
)
60+
61+
# Validate input_audio_transcription
62+
assert config1.input_audio_transcription is not None
63+
assert config2.input_audio_transcription is not None
64+
assert (
65+
config1.input_audio_transcription is not config2.input_audio_transcription
66+
)

0 commit comments

Comments
 (0)