From 7e75752516b725a55891cf1f34dd2ef8ba345ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E7=B6=A0BG?= Date: Sat, 18 Jul 2026 20:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test(stt):=20isolate=20null=20confi?= =?UTF-8?q?g=20from=20language=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/tools/test_transcription.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/tools/test_transcription.py b/tests/tools/test_transcription.py index e8e925d5314..d5c3903ff13 100644 --- a/tests/tools/test_transcription.py +++ b/tests/tools/test_transcription.py @@ -217,6 +217,28 @@ class TestTranscribeLocal: assert result["success"] is True assert "initial_prompt" not in mock_model.transcribe.call_args.kwargs + def test_accepts_null_local_config(self, monkeypatch, tmp_path): + monkeypatch.delenv("HERMES_LOCAL_STT_LANGUAGE", raising=False) + audio_file = tmp_path / "test.ogg" + audio_file.write_bytes(b"fake audio") + + mock_info = MagicMock(language="en", duration=2.5) + mock_model = MagicMock() + mock_model.transcribe.return_value = ([], mock_info) + + fake_fw = _fake_faster_whisper_module(mock_model) + with patch("tools.transcription_tools._HAS_FASTER_WHISPER", True), \ + patch("tools.transcription_tools._load_stt_config", return_value={ + "local": None, + }), \ + patch.dict("sys.modules", {"faster_whisper": fake_fw}), \ + patch("tools.transcription_tools._local_model", None): + from tools.transcription_tools import _transcribe_local + result = _transcribe_local(str(audio_file), "base") + + assert result["success"] is True + assert mock_model.transcribe.call_args.kwargs == {"beam_size": 5} + def test_not_installed(self): with patch("tools.transcription_tools._HAS_FASTER_WHISPER", False): from tools.transcription_tools import _transcribe_local