diff options
author | Vitiko <[email protected]> | 2023-07-23 23:40:20 -0400 |
---|---|---|
committer | Vitiko <[email protected]> | 2023-07-23 23:40:20 -0400 |
commit | c11af96950f134aca6b2331b03a206960bd883ba (patch) | |
tree | c8bf98285d8374af432acae2ec75e64f3a0c4771 /tests | |
parent | fdefb85b1fd454ec5249f77151aa4b25455bf59c (diff) | |
download | bazarr-c11af96950f134aca6b2331b03a206960bd883ba.tar.gz bazarr-c11af96950f134aca6b2331b03a206960bd883ba.zip |
Embedded subtitles: fix #2195v1.2.5-beta.1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/subliminal_patch/test_embeddedsubtitles.py | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py index ae7641a5f..47e322287 100644 --- a/tests/subliminal_patch/test_embeddedsubtitles.py +++ b/tests/subliminal_patch/test_embeddedsubtitles.py @@ -199,9 +199,8 @@ def test_list_subtitles_hi_fallback_multiple_streams( return_value=[fake_streams["en_hi"], fake_streams["en"]], ) subs = provider.list_subtitles(video_single_language, {language}) - assert len(subs) == 2 - assert subs[0].language == Language("eng", hi=True) - assert subs[1].language == Language("eng", hi=False) + assert len(subs) == 1 + assert subs[0].language == Language("eng", hi=False) def test_list_subtitles_hi_fallback_multiple_language_streams( @@ -219,10 +218,31 @@ def test_list_subtitles_hi_fallback_multiple_language_streams( ], ) subs = provider.list_subtitles(video_single_language, languages) - assert len(subs) == 3 + assert len(subs) == 2 assert subs[0].hearing_impaired == False # English subittle assert subs[1].hearing_impaired == False # Spanish subtitle - assert subs[2].hearing_impaired == True # Spanish HI subtitle + + +def test_list_subtitles_hi_fallback_multiple_language_streams_multiple_input_languages( + video_single_language, fake_streams, mocker +): + with EmbeddedSubtitlesProvider(hi_fallback=True) as provider: + languages = { + Language.fromalpha2("en"), + Language.fromalpha2("es"), + Language("spa", hi=True), + } + mocker.patch( + # "fese.FFprobeVideoContainer.get_subtitles", + "subliminal_patch.providers.embeddedsubtitles._MemoizedFFprobeVideoContainer.get_subtitles", + return_value=[ + fake_streams["en_hi"], + fake_streams["es"], + fake_streams["es_hi"], + ], + ) + subs = provider.list_subtitles(video_single_language, languages) + assert len(subs) == 3 def test_list_subtitles_hi_fallback_multiple_hi_streams( |