mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
✅ test(stt): isolate null config from language env
This commit is contained in:
parent
131251a1ae
commit
7e75752516
1 changed files with 22 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue