From 260c765b6f20ddb35c7a30fed9eafa8277c3553f Mon Sep 17 00:00:00 2001 From: Vitiko Date: Mon, 18 Apr 2022 16:31:05 -0400 Subject: [PATCH] no log: update some tests --- tests/subliminal_patch/conftest.py | 23 +++++++++++++++++++ .../test_embeddedsubtitles.py | 10 ++++---- tests/subliminal_patch/test_subf2m.py | 16 +++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/tests/subliminal_patch/conftest.py b/tests/subliminal_patch/conftest.py index 167acfad1..afd2cc913 100644 --- a/tests/subliminal_patch/conftest.py +++ b/tests/subliminal_patch/conftest.py @@ -63,6 +63,14 @@ def movies(): video_codec="H.264", year=2013, ), + "inexistent": Movie( + "inexistent.movie.2013.720p.bluray.x264-sparks.mkv", + "231231asdklsad2321", + source="Blu-Ray", + resolution="720p", + video_codec="H.264", + year=2050, + ), "blade_runner": Movie( "Alien (1979) Theatrical HDR 1080p UHD BluRay x265 HEVC EAC3-SARTRE", "Alien", @@ -118,4 +126,19 @@ def episodes(): resolution="720p", video_codec="H.264", ), + "inexistent": Episode( + "Inexistent.TVShow.S01E01.720p.BluRay.X264-REWARD.mkv", + "121361asdfgh", + 1, + 1, + source="Blu-Ray", + release_group="REWARD", + resolution="720p", + video_codec="H.264", + ), } + + +@pytest.fixture +def data(): + return os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py index 0301c2f0b..942c5a56a 100644 --- a/tests/subliminal_patch/test_embeddedsubtitles.py +++ b/tests/subliminal_patch/test_embeddedsubtitles.py @@ -15,17 +15,15 @@ from subliminal_patch.providers.embeddedsubtitles import \ EmbeddedSubtitlesProvider from subzero.language import Language -_DATA = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") - fese.Language = Language @pytest.fixture -def video_single_language(): +def video_single_language(data): # Has only ASS streams in english return Episode( - os.path.join(_DATA, "file_1.mkv"), + os.path.join(data, "file_1.mkv"), "Serial Experiments Lain", 1, 1, @@ -34,10 +32,10 @@ def video_single_language(): @pytest.fixture -def video_multiple_languages(): +def video_multiple_languages(data): # Has SubRip streams in multiple languages return Movie( - os.path.join(_DATA, "file_2.mkv"), + os.path.join(data, "file_2.mkv"), "I'm No Longer Here", year=2019, source="Web", diff --git a/tests/subliminal_patch/test_subf2m.py b/tests/subliminal_patch/test_subf2m.py index bdc956914..729ed3663 100644 --- a/tests/subliminal_patch/test_subf2m.py +++ b/tests/subliminal_patch/test_subf2m.py @@ -79,6 +79,14 @@ def test_list_subtitles_movie(movies): assert provider.list_subtitles(movies["dune"], {Language.fromalpha2("en")}) +def test_list_subtitles_inexistent_movie(movies): + with Subf2mProvider() as provider: + assert ( + provider.list_subtitles(movies["inexistent"], {Language.fromalpha2("en")}) + == [] + ) + + def test_list_subtitles_episode(episodes): with Subf2mProvider() as provider: assert provider.list_subtitles( @@ -86,6 +94,14 @@ def test_list_subtitles_episode(episodes): ) +def test_list_subtitles_inexistent_episode(episodes): + with Subf2mProvider() as provider: + assert ( + provider.list_subtitles(episodes["inexistent"], {Language.fromalpha2("en")}) + == [] + ) + + def test_download_subtitle(subtitle): with Subf2mProvider() as provider: provider.download_subtitle(subtitle)