summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorsilentcommitter <[email protected]>2022-10-22 21:26:28 +0200
committerGitHub <[email protected]>2022-10-22 15:26:28 -0400
commitd4203ee7cb511feb520b603fea875f9d3451af06 (patch)
tree685792fbf4118909b83ede3e741cae8ebec6295d /tests
parent21359b32b551ac13ecedc07b83f8c90bf080ec53 (diff)
downloadbazarr-d4203ee7cb511feb520b603fea875f9d3451af06.tar.gz
bazarr-d4203ee7cb511feb520b603fea875f9d3451af06.zip
Subf2m provider improvements (#1973)v1.1.3-beta.4
* subf2m provider: add more languages * subf2m provider: use urllib parse rather than string replacement * subf2m provider: change movie title matching to match exact year and use similarity based title matching * subf2m provider: change tvshow title matching to match exact season and use similarity based title matching * no log: Subf2m Provider: add tests * Subf2m Provider: add serbian support Co-authored-by: Vitiko <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/subliminal_patch/test_subf2m.py41
1 files changed, 33 insertions, 8 deletions
diff --git a/tests/subliminal_patch/test_subf2m.py b/tests/subliminal_patch/test_subf2m.py
index 49651f3d5..0e1b70121 100644
--- a/tests/subliminal_patch/test_subf2m.py
+++ b/tests/subliminal_patch/test_subf2m.py
@@ -5,20 +5,45 @@ from subliminal_patch.providers.subf2m import Subf2mSubtitle
from subzero.language import Language
-def test_search_movie(movies):
- movie = movies["dune"]
+ "title,year,expected_url",
+ [
+ (
+ "Dead Man's Chest",
+ 2006,
+ "/subtitles/pirates-of-the-caribbean-2-dead-mans-chest",
+ ),
+ ("Dune", 2021, "/subtitles/dune-2021"),
+ ("Cure", 1997, "/subtitles/cure-kyua"),
+ ],
+)
+def test_search_movie(movies, title, year, expected_url):
+ movie = list(movies.values())[0]
+ movie.title = title
+ movie.year = year
with Subf2mProvider() as provider:
result = provider._search_movie(movie.title, movie.year)
- assert result == "/subtitles/dune-2021"
-
-
-def test_search_tv_show_season(episodes):
- episode = episodes["breaking_bad_s01e01"]
+ assert result == expected_url
+
+
+ "title,season,expected_url",
+ [
+ ("Breaking Bad", 1, "/subtitles/breaking-bad-first-season"),
+ ("House Of The Dragon", 1, "/subtitles/house-of-the-dragon-first-season"),
+ ("The Bear", 1, "/subtitles/the-bear-first-season"),
+ ],
+)
+def test_search_tv_show_season(episodes, title, season, expected_url):
+ episode = list(episodes.values())[0]
+ episode.name = title
+ episode.series = title
+ episode.season = season
with Subf2mProvider() as provider:
result = provider._search_tv_show_season(episode.series, episode.season)
- assert result == "/subtitles/breaking-bad-first-season"
+ assert result == expected_url
@pytest.mark.parametrize("language", [Language.fromalpha2("en"), Language("por", "BR")])