chore: apply pre-commit auto-fixes (trim trailing whitespace, EOF)
This commit is contained in:
@@ -79,9 +79,7 @@ def client():
|
||||
|
||||
class TestInit:
|
||||
def test_explicit_args(self):
|
||||
c = QBittorrentClient(
|
||||
host="http://x:1", username="u", password="p", timeout=99
|
||||
)
|
||||
c = QBittorrentClient(host="http://x:1", username="u", password="p", timeout=99)
|
||||
assert c.host == "http://x:1"
|
||||
assert c.username == "u"
|
||||
assert c.password == "p"
|
||||
@@ -265,9 +263,7 @@ class TestMutations:
|
||||
def test_delete_no_files_default(self, client):
|
||||
self._ok(client)
|
||||
client.delete_torrent("hash1")
|
||||
assert (
|
||||
client.session.post.call_args.kwargs["data"]["deleteFiles"] == "false"
|
||||
)
|
||||
assert client.session.post.call_args.kwargs["data"]["deleteFiles"] == "false"
|
||||
|
||||
def test_pause(self, client):
|
||||
self._ok(client)
|
||||
@@ -328,9 +324,7 @@ class TestFindByName:
|
||||
|
||||
def test_case_insensitive_match(self, client):
|
||||
client._authenticated = True
|
||||
client.session.get.return_value = _resp(
|
||||
[_torrent_dict("foundation.s01")]
|
||||
)
|
||||
client.session.get.return_value = _resp([_torrent_dict("foundation.s01")])
|
||||
result = client.find_by_name("Foundation.S01")
|
||||
assert result is not None
|
||||
assert result.name == "foundation.s01"
|
||||
|
||||
@@ -231,11 +231,7 @@ class TestSearchMedia:
|
||||
def test_tv_uses_name_field(self, mock_get, client):
|
||||
mock_get.side_effect = [
|
||||
_ok_response(
|
||||
{
|
||||
"results": [
|
||||
{"id": 1396, "media_type": "tv", "name": "Breaking Bad"}
|
||||
]
|
||||
}
|
||||
{"results": [{"id": 1396, "media_type": "tv", "name": "Breaking Bad"}]}
|
||||
),
|
||||
_ok_response({"imdb_id": "tt0903747"}),
|
||||
]
|
||||
@@ -281,9 +277,7 @@ class TestSearchMedia:
|
||||
def test_external_ids_failure_returns_result_without_imdb(self, mock_get, client):
|
||||
# Second call (external IDs) fails — the search should still succeed.
|
||||
mock_get.side_effect = [
|
||||
_ok_response(
|
||||
{"results": [{"id": 1, "media_type": "movie", "title": "X"}]}
|
||||
),
|
||||
_ok_response({"results": [{"id": 1, "media_type": "movie", "title": "X"}]}),
|
||||
Timeout("slow"),
|
||||
]
|
||||
result = client.search_media("X")
|
||||
|
||||
@@ -160,13 +160,15 @@ class TestUpdateParseAndProbe:
|
||||
class TestUpdateTmdb:
|
||||
def test_promotes_identity_to_top_level(self, tmp_path):
|
||||
s = MetadataStore(tmp_path)
|
||||
s.update_tmdb({
|
||||
"status": "ok",
|
||||
"imdb_id": "tt1375666",
|
||||
"tmdb_id": 27205,
|
||||
"media_type": "movie",
|
||||
"title": "Inception",
|
||||
})
|
||||
s.update_tmdb(
|
||||
{
|
||||
"status": "ok",
|
||||
"imdb_id": "tt1375666",
|
||||
"tmdb_id": 27205,
|
||||
"media_type": "movie",
|
||||
"title": "Inception",
|
||||
}
|
||||
)
|
||||
data = s.load()
|
||||
assert data["imdb_id"] == "tt1375666"
|
||||
assert data["tmdb_id"] == 27205
|
||||
|
||||
@@ -38,17 +38,23 @@ def _write(path: Path, data: dict) -> None:
|
||||
|
||||
class TestFilterOverride:
|
||||
def test_keeps_only_valid_keys(self):
|
||||
out = _filter_override({
|
||||
"languages": ["fra"],
|
||||
"formats": ["srt"],
|
||||
"types": ["standard"],
|
||||
"format_priority": ["srt"],
|
||||
"min_confidence": 0.8,
|
||||
"unknown_key": "ignored",
|
||||
"another": 42,
|
||||
})
|
||||
out = _filter_override(
|
||||
{
|
||||
"languages": ["fra"],
|
||||
"formats": ["srt"],
|
||||
"types": ["standard"],
|
||||
"format_priority": ["srt"],
|
||||
"min_confidence": 0.8,
|
||||
"unknown_key": "ignored",
|
||||
"another": 42,
|
||||
}
|
||||
)
|
||||
assert set(out) == {
|
||||
"languages", "formats", "types", "format_priority", "min_confidence"
|
||||
"languages",
|
||||
"formats",
|
||||
"types",
|
||||
"format_priority",
|
||||
"min_confidence",
|
||||
}
|
||||
assert "unknown_key" not in out
|
||||
|
||||
@@ -113,9 +119,7 @@ class TestLoad:
|
||||
{"override": {"min_confidence": 0.99}},
|
||||
)
|
||||
repo = RuleSetRepository(tmp_path)
|
||||
rules = repo.load(
|
||||
release_group="GRP", subtitle_preferences=prefs
|
||||
).resolve()
|
||||
rules = repo.load(release_group="GRP", subtitle_preferences=prefs).resolve()
|
||||
# All three levels visible — local overrides on top
|
||||
assert rules.preferred_languages == ["jpn"]
|
||||
assert rules.format_priority == ["ass"]
|
||||
|
||||
@@ -30,7 +30,9 @@ FRA = SubtitleLanguage(code="fra", tokens=["fr"])
|
||||
ENG = SubtitleLanguage(code="eng", tokens=["en"])
|
||||
|
||||
|
||||
def _track(lang=FRA, *, embedded: bool = False, confidence: float = 0.92) -> SubtitleCandidate:
|
||||
def _track(
|
||||
lang=FRA, *, embedded: bool = False, confidence: float = 0.92
|
||||
) -> SubtitleCandidate:
|
||||
return SubtitleCandidate(
|
||||
language=lang,
|
||||
format=SRT,
|
||||
|
||||
Reference in New Issue
Block a user