diff options
author | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
---|---|---|
committer | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
commit | 4cc6806193127f9d6d3f2dab26969471d9bbf159 (patch) | |
tree | bfc90e4b55fa0f48f83e51c4e5947c1f7d7d7a2d /tests/subliminal_patch/test_embeddedsubtitles.py | |
parent | d875dc7733c901246881325ee3a84fe5d44b10b9 (diff) | |
parent | 5886c20c9c7929bf46836a99c2d9d4eb834638bd (diff) | |
download | bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.tar.gz bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.zip |
Merge branch 'development' of https://github.com/morpheus65535/bazarr into development
Diffstat (limited to 'tests/subliminal_patch/test_embeddedsubtitles.py')
-rw-r--r-- | tests/subliminal_patch/test_embeddedsubtitles.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py index d7f157de1..b7bfaa0a8 100644 --- a/tests/subliminal_patch/test_embeddedsubtitles.py +++ b/tests/subliminal_patch/test_embeddedsubtitles.py @@ -8,9 +8,9 @@ from fese.exceptions import LanguageNotFound import pytest from subliminal_patch.core import Episode from subliminal_patch.core import Movie +from subliminal_patch.providers.embeddedsubtitles import _clean_ass_subtitles from subliminal_patch.providers.embeddedsubtitles import ( _discard_possible_incomplete_subtitles, - _clean_ass_subtitles, ) from subliminal_patch.providers.embeddedsubtitles import _get_pretty_release_name from subliminal_patch.providers.embeddedsubtitles import _MemoizedFFprobeVideoContainer @@ -127,7 +127,9 @@ def fake_streams(): @pytest.mark.parametrize("tags_", [{}, {"language": "und", "title": "Unknown"}]) def test_list_subtitles_unknown_as_fallback(mocker, tags_, video_single_language): - with EmbeddedSubtitlesProvider(unknown_as_fallback=True, fallback_lang="en") as provider: + with EmbeddedSubtitlesProvider( + unknown_as_fallback=True, fallback_lang="en" + ) as provider: fake = FFprobeSubtitleStream( {"index": 3, "codec_name": "subrip", "tags": tags_} ) @@ -144,7 +146,9 @@ def test_list_subtitles_unknown_as_fallback(mocker, tags_, video_single_language def test_list_subtitles_unknown_as_fallback_w_real_english_subtitles( video_single_language, mocker ): - with EmbeddedSubtitlesProvider(unknown_as_fallback=True, fallback_lang="en") as provider: + with EmbeddedSubtitlesProvider( + unknown_as_fallback=True, fallback_lang="en" + ) as provider: fakes = [ FFprobeSubtitleStream( {"index": 3, "codec_name": "subrip", "tags": {"language": "und"}} @@ -165,7 +169,7 @@ def test_list_subtitles_unknown_as_fallback_w_real_english_subtitles( @pytest.mark.parametrize("tags_", [{}, {"language": "und", "title": "Unknown"}]) def test_list_subtitles_unknown_as_fallback_disabled(tags_): - with EmbeddedSubtitlesProvider(unknown_as_fallback=False,fallback_lang="en"): + with EmbeddedSubtitlesProvider(unknown_as_fallback=False, fallback_lang="en"): with pytest.raises(LanguageNotFound): assert FFprobeSubtitleStream( {"index": 3, "codec_name": "subrip", "tags": tags_} @@ -362,6 +366,21 @@ def test_download_subtitle_single(video_single_language): assert subtitle.is_valid() +def test_download_subtitle_single_is_ass(video_single_language): + with EmbeddedSubtitlesProvider() as provider: + subtitle = provider.list_subtitles( + video_single_language, {Language.fromalpha2("en")} + )[0] + provider.download_subtitle(subtitle) + assert subtitle.is_valid() + + assert subtitle.format == "srt" + + subtitle.use_original_format = True + + assert subtitle.format == "ass" + + def test_memoized(video_single_language, mocker): with EmbeddedSubtitlesProvider() as provider: provider.list_subtitles(video_single_language, {Language.fromalpha2("en")}) |