Extrait la transcription derriere le contrat Transcripteur
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""La fabrique choisit le moteur d'après le matériel — décision pure, testable
|
||||
depuis n'importe quelle machine."""
|
||||
import pytest
|
||||
|
||||
from moteur import choisir_transcripteur, nom_moteur_pour
|
||||
|
||||
|
||||
@pytest.mark.parametrize("plateforme, machine, cuda, attendu", [
|
||||
("darwin", "arm64", False, "mlx"),
|
||||
("darwin", "x86_64", False, "faster-cpu"),
|
||||
("win32", "AMD64", True, "faster-gpu"),
|
||||
("win32", "AMD64", False, "faster-cpu"),
|
||||
])
|
||||
def test_la_decision_suit_le_materiel(plateforme, machine, cuda, attendu):
|
||||
assert nom_moteur_pour(plateforme, machine, cuda) == attendu
|
||||
|
||||
|
||||
def test_apple_silicon_prend_mlx_meme_sans_cuda():
|
||||
assert nom_moteur_pour("darwin", "arm64", cuda_disponible=False) == "mlx"
|
||||
|
||||
|
||||
def test_la_fabrique_rend_un_transcripteur_complet():
|
||||
t = choisir_transcripteur(nom="mlx", modele="mlx-community/whisper-medium",
|
||||
langue="fr", amorce="")
|
||||
assert callable(t.warmup) and callable(t.transcrire)
|
||||
|
||||
|
||||
def test_un_moteur_inconnu_est_refuse_clairement():
|
||||
with pytest.raises(NotImplementedError) as e:
|
||||
choisir_transcripteur(nom="vosk", modele="x", langue="fr", amorce="")
|
||||
assert "vosk" in str(e.value)
|
||||
Reference in New Issue
Block a user