File size: 636 Bytes
1d697a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest

from lang import detect_language
from utils import fmt_time


@pytest.mark.parametrize("text,lang", [
    ("Jak ta osoba ma na imię?", "Polish"),
    ("co się dzieje w tym filmie", "Polish"),
    ("What is this video about?", "English"),
    ("summarize the video", "English"),
    ("take care", "English"),
])
def test_detect(text, lang):
    assert detect_language(text).lower().startswith(lang.lower()[:3])


@pytest.mark.parametrize("secs,out", [
    (0, "0:00"), (5.4, "0:05"), (65, "1:05"), (599.6, "10:00"), (3600, "1:00:00"), (3725, "1:02:05"),
])
def test_fmt_time(secs, out):
    assert fmt_time(secs) == out