chore: apply pre-commit auto-fixes (trim trailing whitespace, EOF)
This commit is contained in:
@@ -78,7 +78,9 @@ class TestFindExistingTvshowFolders:
|
||||
(tmp_path / "oz.1997.bluray-OTHER").mkdir()
|
||||
(tmp_path / "OtherShow.1999").mkdir()
|
||||
out = _find_existing_tvshow_folders(tmp_path, "Oz", 1997)
|
||||
assert out == ["Oz.1997.WEBRip-KONTRAST", "oz.1997.bluray-OTHER"] or set(out) == {
|
||||
assert out == ["Oz.1997.WEBRip-KONTRAST", "oz.1997.bluray-OTHER"] or set(
|
||||
out
|
||||
) == {
|
||||
"Oz.1997.WEBRip-KONTRAST",
|
||||
"oz.1997.bluray-OTHER",
|
||||
}
|
||||
@@ -103,28 +105,42 @@ class TestResolveSeriesFolderInternal:
|
||||
def test_confirmed_folder_when_exists(self, tmp_path):
|
||||
(tmp_path / "Oz.1997.X-GRP").mkdir()
|
||||
out = _resolve_series_folder(
|
||||
tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", confirmed_folder="Oz.1997.X-GRP"
|
||||
tmp_path,
|
||||
"Oz",
|
||||
1997,
|
||||
"Oz.1997.WEBRip-KONTRAST",
|
||||
confirmed_folder="Oz.1997.X-GRP",
|
||||
)
|
||||
assert out == ("Oz.1997.X-GRP", False)
|
||||
|
||||
def test_confirmed_folder_when_new(self, tmp_path):
|
||||
out = _resolve_series_folder(
|
||||
tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", confirmed_folder="Oz.1997.New-X"
|
||||
tmp_path,
|
||||
"Oz",
|
||||
1997,
|
||||
"Oz.1997.WEBRip-KONTRAST",
|
||||
confirmed_folder="Oz.1997.New-X",
|
||||
)
|
||||
assert out == ("Oz.1997.New-X", True)
|
||||
|
||||
def test_no_existing_returns_computed_as_new(self, tmp_path):
|
||||
out = _resolve_series_folder(tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None)
|
||||
out = _resolve_series_folder(
|
||||
tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None
|
||||
)
|
||||
assert out == ("Oz.1997.WEBRip-KONTRAST", True)
|
||||
|
||||
def test_single_existing_matching_computed_returns_existing(self, tmp_path):
|
||||
(tmp_path / "Oz.1997.WEBRip-KONTRAST").mkdir()
|
||||
out = _resolve_series_folder(tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None)
|
||||
out = _resolve_series_folder(
|
||||
tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None
|
||||
)
|
||||
assert out == ("Oz.1997.WEBRip-KONTRAST", False)
|
||||
|
||||
def test_single_existing_different_name_returns_clarification(self, tmp_path):
|
||||
(tmp_path / "Oz.1997.BluRay-OTHER").mkdir()
|
||||
out = _resolve_series_folder(tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None)
|
||||
out = _resolve_series_folder(
|
||||
tmp_path, "Oz", 1997, "Oz.1997.WEBRip-KONTRAST", None
|
||||
)
|
||||
assert isinstance(out, _Clarification)
|
||||
assert "Oz" in out.question
|
||||
assert "Oz.1997.BluRay-OTHER" in out.options
|
||||
@@ -185,7 +201,9 @@ class TestSeason:
|
||||
assert out.series_folder_name.startswith("Oz.1997")
|
||||
assert out.season_folder_name.startswith("Oz.S03")
|
||||
assert out.series_folder == str(tv / out.series_folder_name)
|
||||
assert out.season_folder == str(tv / out.series_folder_name / out.season_folder_name)
|
||||
assert out.season_folder == str(
|
||||
tv / out.series_folder_name / out.season_folder_name
|
||||
)
|
||||
|
||||
def test_clarification_path(self, cfg_memory):
|
||||
_, tv, _ = cfg_memory
|
||||
@@ -222,32 +240,29 @@ class TestEpisode:
|
||||
)
|
||||
|
||||
def test_ok_path_without_episode_title(self, cfg_memory):
|
||||
out = resolve_episode_destination(
|
||||
REL_EPISODE, "/dl/source.mkv", "Oz", 1997
|
||||
)
|
||||
out = resolve_episode_destination(REL_EPISODE, "/dl/source.mkv", "Oz", 1997)
|
||||
assert out.status == "ok"
|
||||
# No '..' from blank ep title.
|
||||
assert ".." not in out.filename
|
||||
|
||||
def test_extension_taken_from_source_file(self, cfg_memory):
|
||||
out = resolve_episode_destination(
|
||||
REL_EPISODE, "/dl/source.mp4", "Oz", 1997
|
||||
)
|
||||
out = resolve_episode_destination(REL_EPISODE, "/dl/source.mp4", "Oz", 1997)
|
||||
assert out.filename.endswith(".mp4")
|
||||
|
||||
def test_clarification_path(self, cfg_memory):
|
||||
_, tv, _ = cfg_memory
|
||||
(tv / "Oz.1997.BluRay-OTHER").mkdir()
|
||||
out = resolve_episode_destination(
|
||||
REL_EPISODE, "/dl/source.mkv", "Oz", 1997
|
||||
)
|
||||
out = resolve_episode_destination(REL_EPISODE, "/dl/source.mkv", "Oz", 1997)
|
||||
assert out.status == "needs_clarification"
|
||||
|
||||
def test_confirmed_folder_threaded_through(self, cfg_memory):
|
||||
_, tv, _ = cfg_memory
|
||||
(tv / "Oz.1997.BluRay-OTHER").mkdir()
|
||||
out = resolve_episode_destination(
|
||||
REL_EPISODE, "/dl/source.mkv", "Oz", 1997,
|
||||
REL_EPISODE,
|
||||
"/dl/source.mkv",
|
||||
"Oz",
|
||||
1997,
|
||||
confirmed_folder="Oz.1997.BluRay-OTHER",
|
||||
)
|
||||
assert out.status == "ok"
|
||||
@@ -340,13 +355,21 @@ class TestDTOToDict:
|
||||
d = ResolvedSeasonDestination(
|
||||
status="error", error="library_not_set", message="missing"
|
||||
).to_dict()
|
||||
assert d == {"status": "error", "error": "library_not_set", "message": "missing"}
|
||||
assert d == {
|
||||
"status": "error",
|
||||
"error": "library_not_set",
|
||||
"message": "missing",
|
||||
}
|
||||
|
||||
def test_season_clarification(self):
|
||||
d = ResolvedSeasonDestination(
|
||||
status="needs_clarification", question="which?", options=["a", "b"]
|
||||
).to_dict()
|
||||
assert d == {"status": "needs_clarification", "question": "which?", "options": ["a", "b"]}
|
||||
assert d == {
|
||||
"status": "needs_clarification",
|
||||
"question": "which?",
|
||||
"options": ["a", "b"],
|
||||
}
|
||||
|
||||
def test_episode_ok(self):
|
||||
d = ResolvedEpisodeDestination(
|
||||
|
||||
Reference in New Issue
Block a user