summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorvitiko98 <[email protected]>2022-07-20 02:51:30 -0400
committervitiko98 <[email protected]>2022-07-20 02:51:30 -0400
commit5624ae431ea6e1d29a0c9fd909949e1021dc1226 (patch)
tree4b6cf26abdf1a088fb4fc6f58cf1cc4738d64627 /tests
parent27d792041c6deda7d31913fda189aea2725029d7 (diff)
downloadbazarr-5624ae431ea6e1d29a0c9fd909949e1021dc1226.tar.gz
bazarr-5624ae431ea6e1d29a0c9fd909949e1021dc1226.zip
Embedded Subtitles provider: add support for unknown language tagsv1.1.1-beta.6
Diffstat (limited to 'tests')
-rw-r--r--tests/bazarr/app/test_get_providers.py1
-rw-r--r--tests/subliminal_patch/test_embeddedsubtitles.py26
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/bazarr/app/test_get_providers.py b/tests/bazarr/app/test_get_providers.py
index 3b28da186..caafa17d9 100644
--- a/tests/bazarr/app/test_get_providers.py
+++ b/tests/bazarr/app/test_get_providers.py
@@ -34,6 +34,7 @@ def test_get_providers_auth_embeddedsubtitles():
assert isinstance(item["ffprobe_path"], str)
assert isinstance(item["ffmpeg_path"], str)
assert isinstance(item["timeout"], str)
+ assert isinstance(item["unknown_as_english"], bool)
def test_get_providers_auth_karagarga():
diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py
index 6771cad5d..d858581f8 100644
--- a/tests/subliminal_patch/test_embeddedsubtitles.py
+++ b/tests/subliminal_patch/test_embeddedsubtitles.py
@@ -4,6 +4,7 @@ import os
from fese import FFprobeSubtitleStream
from fese import FFprobeVideoContainer
from fese import tags
+from fese.exceptions import LanguageNotFound
import pytest
from subliminal_patch.core import Episode
from subliminal_patch.core import Movie
@@ -123,13 +124,36 @@ def fake_streams():
}
[email protected]("tags_", [{}, {"language": "und", "title": "Unknown"}])
+def test_list_subtitles_unknown_as_english(mocker, tags_):
+ with EmbeddedSubtitlesProvider(unknown_as_english=True):
+ fake = FFprobeSubtitleStream(
+ {"index": 3, "codec_name": "subrip", "tags": tags_}
+ )
+ mocker.patch(
+ "subliminal_patch.providers.embeddedsubtitles._MemoizedFFprobeVideoContainer.get_subtitles",
+ return_value=[fake],
+ )
+ streams = _MemoizedFFprobeVideoContainer.get_subtitles("")
+ assert len(streams) == 1
+ assert streams[0].language == Language.fromietf("en")
+
+
[email protected]("tags_", [{}, {"language": "und", "title": "Unknown"}])
+def test_list_subtitles_unknown_as_english_disabled(tags_):
+ with EmbeddedSubtitlesProvider(unknown_as_english=False):
+ with pytest.raises(LanguageNotFound):
+ assert FFprobeSubtitleStream(
+ {"index": 3, "codec_name": "subrip", "tags": tags_}
+ )
+
+
def test_list_subtitles_hi_fallback_one_stream(
video_single_language, fake_streams, mocker
):
with EmbeddedSubtitlesProvider(hi_fallback=True) as provider:
language = Language.fromalpha2("en")
mocker.patch(
- # "fese.FFprobeVideoContainer.get_subtitles",
"subliminal_patch.providers.embeddedsubtitles._MemoizedFFprobeVideoContainer.get_subtitles",
return_value=[fake_streams["en_hi"]],
)