feat: Transcriber akzeptiert optionales vorgeladenes WhisperModel

This commit is contained in:
2026-04-12 12:26:20 +02:00
parent e0893917c1
commit 3a580990ea
2 changed files with 22 additions and 5 deletions
+7 -1
View File
@@ -10,7 +10,7 @@ class TestTranscriber:
@patch("whisper_local.transcriber.WhisperModel")
def test_init_loads_model(self, mock_model_class):
t = Transcriber(model_name="small", compute_type="int8", language="de")
mock_model_class.assert_called_once_with("small", compute_type="int8")
mock_model_class.assert_called_once_with("small", compute_type="int8", download_root=None)
assert t.language == "de"
@patch("whisper_local.transcriber.WhisperModel")
@@ -55,3 +55,9 @@ class TestTranscriber:
result = t.transcribe(audio)
assert result == "Hallo Welt"
def test_init_with_preloaded_model(self):
mock_model = MagicMock()
t = Transcriber(language="de", model=mock_model)
assert t.model is mock_model
assert t.language == "de"