From 25f8d676f48306145a1e80ce1e9e4b7f93a2fa10 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Mon, 26 Oct 2026 16:12:07 -0300 Subject: [PATCH] test(elevenlabs): cover the diarization fallback when soundfile is absent --- .../elevenlabs/audio_transcription/test_transformation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/llms/elevenlabs/audio_transcription/test_transformation.py b/tests/unit/llms/elevenlabs/audio_transcription/test_transformation.py index feffbaf4556..f36492c68dd 100644 --- a/tests/unit/llms/elevenlabs/audio_transcription/test_transformation.py +++ b/tests/unit/llms/elevenlabs/audio_transcription/test_transformation.py @@ -1,4 +1,5 @@ import io +import sys from collections.abc import Iterator from typing import Final @@ -212,6 +213,13 @@ def test_unreadable_audio_falls_back_to_acoustic_diarize(): assert _form_data(b"not audio at all", {"diarize": True}) == {"model_id": "scribe_v2", "diarize": "True"} +def test_stereo_audio_without_soundfile_installed_falls_back_to_acoustic_diarize(monkeypatch: pytest.MonkeyPatch): + stereo: Final = _wav_bytes(2) + monkeypatch.setitem(sys.modules, "soundfile", None) + + assert _form_data(stereo, {"diarize": True}) == {"model_id": "scribe_v2", "diarize": "True"} + + def test_diarized_response_builds_speaker_segments(): response: Final = _transform( {