mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 11:26:25 -05:00
56 lines
2.9 KiB
Python
56 lines
2.9 KiB
Python
from wrolpi import captions
|
|
|
|
|
|
def test_bad_caption(bad_vtt_file):
|
|
"""A caption file that cannot be parsed is ignored."""
|
|
result = captions.read_captions(bad_vtt_file)
|
|
assert result is None
|
|
|
|
|
|
def test_get_caption_text(vtt_file1, srt_file3):
|
|
expected = ['okay welcome to this session this is',
|
|
'okay welcome to this session this is',
|
|
'okay welcome to this session this is\ncalled the kinetic bunny need to meet',
|
|
'called the kinetic bunny need to meet',
|
|
'called the kinetic bunny need to meet\nthe virtual bonnie emilio stop this is',
|
|
'the virtual bonnie emilio stop this is',
|
|
'the virtual bonnie emilio stop this is\njana car who just to give a little bit',
|
|
'jana car who just to give a little bit',
|
|
'jana car who just to give a little bit\nof background information we come from a',
|
|
'of background information we come from a',
|
|
'of background information we come from a\ncompany called le code from finland and']
|
|
assert list(captions.get_caption_text(vtt_file1)) == expected
|
|
|
|
expected = ['okay welcome to this session this is',
|
|
'okay welcome to this session this is\ncalled the kinetic bunny need to meet',
|
|
'called the kinetic bunny need to meet',
|
|
'called the kinetic bunny need to meet\n'
|
|
'the virtual bonnie emilio stop this is',
|
|
'the virtual bonnie emilio stop this is',
|
|
'the virtual bonnie emilio stop this is\n'
|
|
'jana car who just to give a little bit',
|
|
'jana car who just to give a little bit',
|
|
'jana car who just to give a little bit\n'
|
|
'of background information we come from a',
|
|
'of background information we come from a',
|
|
'of background information we come from a\n'
|
|
'company called le code from finland and']
|
|
assert list(captions.get_caption_text(srt_file3)) == expected
|
|
|
|
|
|
def test_get_unique_caption_lines(vtt_file1, srt_file3):
|
|
expected = ['okay welcome to this session this is',
|
|
'called the kinetic bunny need to meet',
|
|
'the virtual bonnie emilio stop this is',
|
|
'jana car who just to give a little bit',
|
|
'of background information we come from a',
|
|
'company called le code from finland and']
|
|
assert list(captions.get_unique_caption_lines(vtt_file1)) == expected
|
|
|
|
expected = ['okay welcome to this session this is',
|
|
'called the kinetic bunny need to meet',
|
|
'the virtual bonnie emilio stop this is',
|
|
'jana car who just to give a little bit',
|
|
'of background information we come from a',
|
|
'company called le code from finland and']
|
|
assert list(captions.get_unique_caption_lines(srt_file3)) == expected
|