Run some automatic tests with GitHub Actions (#68)

This commit is contained in:
Guillaume Klein
2023-03-22 20:50:03 +01:00
committed by GitHub
parent 52264f2277
commit 66efd02bd0
9 changed files with 143 additions and 2 deletions

25
tests/test.py Normal file
View File

@@ -0,0 +1,25 @@
from faster_whisper import WhisperModel
def test_transcribe(tiny_model_dir, jfk_path):
model = WhisperModel(tiny_model_dir)
segments, info = model.transcribe(jfk_path, word_timestamps=True)
assert info.language == "en"
assert info.language_probability > 0.9
assert info.duration == 11
segments = list(segments)
assert len(segments) == 1
segment = segments[0]
assert segment.text == (
" And so my fellow Americans ask not what your country can do for you, "
"ask what you can do for your country."
)
assert segment.text == "".join(word.word for word in segment.words)
assert segment.start == segment.words[0].start
assert segment.end == segment.words[-1].end