docs: strip non-essential comments, fold key facts into docstrings

This commit is contained in:
imSp4rky
2026-08-16 23:32:02 -06:00
parent 66bcbe9377
commit 511f96d8db
81 changed files with 204 additions and 1017 deletions
-18
View File
@@ -54,9 +54,6 @@ def default_title_language(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(config, "anilist_title_language", "english")
# ---------- reference parsing ----------
@pytest.mark.parametrize(
("value", "expected"),
[
@@ -82,9 +79,6 @@ def test_parse_anilist_ref(value: Any, expected: Optional[tuple[str, int]]) -> N
assert parse_anilist_ref(value) == expected
# ---------- search ----------
def test_search_returns_the_best_match(monkeypatch: pytest.MonkeyPatch) -> None:
provider, sent = _provider(monkeypatch, {"data": {"Page": {"media": [ONE_PIECE, ONE_PIECE_MOVIE]}}})
@@ -151,9 +145,6 @@ def test_graphql_errors_are_a_miss_not_a_raise(monkeypatch: pytest.MonkeyPatch)
assert provider.get_by_id(21, "tv") is None
# ---------- id lookup ----------
def test_get_by_id_queries_the_anilist_id(monkeypatch: pytest.MonkeyPatch) -> None:
provider, sent = _provider(monkeypatch, {"data": {"Media": ONE_PIECE}})
@@ -189,9 +180,6 @@ def test_get_external_ids_needs_no_lookup_for_a_bare_id(monkeypatch: pytest.Monk
assert sent[0]["variables"] == {"idMal": 21}
# ---------- title variant ----------
@pytest.mark.parametrize(
("configured", "expected"),
[("english", "One Piece"), ("romaji", "ONE PIECE"), ("native", "ONE PIECE"), ("klingon", "One Piece")],
@@ -222,9 +210,6 @@ def test_a_title_with_no_variant_at_all_is_a_miss(monkeypatch: pytest.MonkeyPatc
assert provider.get_by_id(21, "tv") is None
# ---------- derived fields ----------
@pytest.mark.parametrize(
("country", "language"),
[("JP", "ja"), ("KR", "ko"), ("CN", "zh"), ("TW", "zh"), ("US", None), (None, None)],
@@ -258,9 +243,6 @@ def test_the_provider_needs_no_api_key() -> None:
assert AniListProvider.ID_KIND == "anilist"
# ---------- cache round-trip ----------
def test_a_cached_node_rebuilds_with_the_read_time_title_language(monkeypatch: pytest.MonkeyPatch) -> None:
"""The raw node is cached; which title variant it yields follows the config at read time."""
from unshackle.core.providers import cached_to_result
-9
View File
@@ -66,9 +66,6 @@ def test_slow_delay_range_accepts_bool(value, expected):
assert SLOW_DELAY_RANGE.convert(value, None, None) == expected
# --- LanguageRange ----------------------------------------------------------
@pytest.mark.parametrize(
"value,expected",
[
@@ -83,9 +80,6 @@ def test_language_range_passes_exclusion_tokens_through(value, expected):
assert LANGUAGE_RANGE.convert(value) == expected
# --- SeasonRange ------------------------------------------------------------
def parse(*tokens: str) -> list[str]:
return SeasonRange().parse_tokens(*tokens)
@@ -156,9 +150,6 @@ def test_bad_part_tokens_fail(token):
parse(token)
# --- SeasonRange date tokens ------------------------------------------------
def test_single_date_token_is_its_own_key():
assert parse("2026-08-11") == ["2026-08-11"]
-30
View File
@@ -51,9 +51,6 @@ def debug_log_with_keys(tmp_path: Path):
close_debug_logger()
# ---------- JSONL output shape ----------
def test_every_line_is_valid_json_with_required_fields(debug_log: Path):
log_event("sample_event", message="hi", context={"a": 1})
close_debug_logger() # flush session_end
@@ -72,9 +69,6 @@ def test_session_id_is_stable_across_entries(debug_log: Path):
assert len(ids) == 1
# ---------- log_event ----------
def test_log_event_emits_with_level_message_and_context(debug_log: Path):
log_event("feature_done", level="INFO", message="did it", context={"count": 3})
e = find(read_entries(debug_log), "feature_done")
@@ -89,9 +83,6 @@ def test_log_event_noop_when_disabled():
log_event("should_not_explode", message="no logger") # must not raise
# ---------- timed_operation ----------
def test_timed_operation_logs_success_and_duration(debug_log: Path):
with timed_operation("work", level="INFO", context={"k": "v"}):
pass
@@ -120,9 +111,6 @@ def test_timed_operation_noop_when_disabled():
assert value == 2
# ---------- secret redaction / key gating ----------
def test_sanitize_redacts_sensitive_key_names(debug_log: Path):
dl = get_debug_logger()
cleaned = dl.sanitize_data(
@@ -195,9 +183,6 @@ def test_logged_content_url_is_collapsed_on_disk(debug_log: Path):
assert "redacted.mp4" in raw
# ---------- redact.py helpers ----------
@pytest.mark.parametrize(
("text", "expected"),
[
@@ -221,9 +206,6 @@ def test_safe_display_url_strips_userinfo_and_query():
assert safe_display_url("https://u:p@host:8080/a/b?token=x&y=2") == "https://host:8080/a/b"
# ---------- redact_url ----------
@pytest.mark.parametrize(
("url", "expected"),
[
@@ -246,9 +228,6 @@ def test_redact_url_handles_url_embedded_in_text():
assert redact_url("got https://cdn.x/a.mp4 ok") == "got redacted.mp4 ok"
# ---------- redact_path ----------
def test_redact_path_strips_install_root():
# redact.py resolves the project/install root as the <unshackle> anchor.
from unshackle.core.utils import redact as redact_mod
@@ -279,9 +258,6 @@ def test_redact_path_disabled_by_config(monkeypatch):
assert redact_path(full) == "<unshackle>/temp/Audio.mp4"
# ---------- redact_all + output_dir integration ----------
def test_redact_all_composes_secrets_urls_and_paths():
root = str(Path(__import__("unshackle.core.utils.redact", fromlist=["x"]).__file__).resolve().parents[3])
out = redact_all(f"dl https://u:p@cdn.x/seg.mp4?token=t into {root}/temp")
@@ -298,9 +274,6 @@ def test_logged_output_dir_is_path_redacted(debug_log: Path):
assert e["context"]["filename"] == "Audio_3eeab4ed.mp4" # bare filename untouched
# ---------- convenience-helper message override (footgun regression) ----------
def test_log_drm_operation_accepts_message_and_level_override(debug_log: Path):
dl = get_debug_logger()
# Previously raised: TypeError: log() got multiple values for keyword argument 'message'
@@ -332,9 +305,6 @@ def test_log_service_call_accepts_message_override(debug_log: Path):
assert e["request"]["status"] == 200
# ---------- tool_run ----------
def test_log_tool_run_success_is_debug(debug_log: Path):
log_tool_run("ffmpeg concat", "ffmpeg", 0, duration_ms=12.3, segments=5)
e = find(read_entries(debug_log), "tool_run")
-9
View File
@@ -46,9 +46,6 @@ def reset_template():
config.output_template, config.folder_templates, config.folder_template, config.tag = saved
# --- validation -------------------------------------------------------------
def test_absolute_defaults_to_none():
assert make_episode().absolute is None
@@ -86,9 +83,6 @@ def test_old_cache_entry_reads_as_absolute_less():
assert restored.absolute is None
# --- naming -----------------------------------------------------------------
def test_absolute_token_is_three_wide(reset_template):
assert make_episode(absolute=7).build_template_context(StubMediaInfo())["absolute"] == "007"
@@ -122,9 +116,6 @@ def test_str_and_sorting_ignore_the_absolute_number():
assert [e.number for e in series] == [1, 2]
# --- the enrich fill --------------------------------------------------------
class _FakeProvider:
def __init__(self, mapping: dict, source_order: str = "official") -> None:
self.mapping = mapping
-6
View File
@@ -122,9 +122,6 @@ def test_dated_folder_keeps_distinct_year(reset_template):
assert "2013" in folder
# --- selection by date ------------------------------------------------------
def test_a_dated_episode_matches_its_iso_date_key():
assert make_episode(air_date=date(2024, 6, 30)).matches_wanted({"2024-06-30"})
@@ -147,9 +144,6 @@ def test_an_undated_episode_is_unaffected_by_date_keys():
assert episode.matches_wanted({"2024x181"})
# --- the air-date guard -----------------------------------------------------
def test_a_pre_1970_air_date_is_rejected():
with pytest.raises(ValueError):
make_episode(air_date=date(1969, 12, 31))
-11
View File
@@ -44,9 +44,6 @@ def reset_template():
config.output_template, config.folder_templates, config.folder_template, config.tag = saved
# --- validation -------------------------------------------------------------
def test_part_defaults_to_none():
assert make_episode().part is None
@@ -79,9 +76,6 @@ def test_old_cache_entry_reads_as_part_less():
assert restored.part is None
# --- display ----------------------------------------------------------------
def test_str_is_unchanged_without_a_part():
without = make_episode()
assert str(without) == "The Show S01E01 The Reckoning"
@@ -125,9 +119,6 @@ def test_series_sorts_parts_within_their_episode():
assert [(e.number, e.part) for e in series] == [(1, None), (1, 1), (1, 2), (2, None)]
# --- naming -----------------------------------------------------------------
def test_filename_is_unchanged_without_a_part(reset_template):
assert make_episode().get_filename(StubMediaInfo()) == "The.Show.S01E01.DummyService-GROUP"
@@ -168,8 +159,6 @@ def test_parts_share_one_derived_season_folder(reset_template):
assert folders == {make_episode().get_filename(StubMediaInfo(), folder=True)}
# --- matching ---------------------------------------------------------------
# the worked key scheme from the design: (token, part-less E1 selected, E1 part 2 selected)
MATCH_TABLE = [
(("S01",), True, True),
-5
View File
@@ -8,8 +8,6 @@ from langcodes import Language
from unshackle.core.utilities import excluded_language_tags, partition_exclusions
from unshackle.core.utils.click_types import LANGUAGE_RANGE
# --- partition_exclusions ---------------------------------------------------
@pytest.mark.parametrize(
"tokens,expected",
@@ -43,9 +41,6 @@ def test_partition_reads_the_tokens_language_range_produces():
assert partition_exclusions(LANGUAGE_RANGE.convert("all,-es;-fr")) == (["all"], ["es", "fr"])
# --- excluded_language_tags ---------------------------------------------------
def test_close_match_excludes_the_regional_variants():
assert excluded_language_tags(["es"], ["es-419", "es-ES", "en-US"]) == {"es-419", "es-ES"}
-12
View File
@@ -20,9 +20,6 @@ def with_keys(monkeypatch: pytest.MonkeyPatch, **keys: str) -> None:
monkeypatch.setattr(config, name, keys.get(name, ""))
# ---------- one ID at a time ----------
@pytest.mark.parametrize(
("tmdb", "imdb", "tvdb"),
[(27205, "tt1375666", None), (27205, None, 73871), (None, "tt1375666", 73871), (27205, "tt1375666", 73871)],
@@ -42,9 +39,6 @@ def test_imdb_alone_passes_on_the_keyless_provider(monkeypatch: pytest.MonkeyPat
assert validate_metadata_ids(None, "tt1375666", None) is None
# ---------- the ID must have a provider that can resolve it ----------
def test_tmdb_without_its_key_names_the_key(monkeypatch: pytest.MonkeyPatch) -> None:
with_keys(monkeypatch)
with pytest.raises(click.UsageError) as exc:
@@ -88,9 +82,6 @@ def test_one_kind_keeping_the_provider_is_enough(monkeypatch: pytest.MonkeyPatch
assert validate_metadata_ids(None, None, 73871) is None
# ---------- the REST path rejects the same combinations ----------
@pytest.mark.parametrize(
"payload",
[
@@ -114,9 +105,6 @@ def test_api_still_reports_a_malformed_id_first() -> None:
assert err and "positive integer" in err
# ---------- --anilist stays outside the mutual exclusion ----------
@pytest.mark.parametrize("value", [21, "21", "mal:21"])
def test_anilist_alone_passes_without_any_key(monkeypatch: pytest.MonkeyPatch, value: object) -> None:
with_keys(monkeypatch)
-6
View File
@@ -131,9 +131,6 @@ def test_flat_list_config_applies_to_both_kinds(monkeypatch: pytest.MonkeyPatch)
assert [cls.NAME for cls in providers.provider_order()] == ["tvdb", "tmdb"]
# ---------- the anilist namespace ----------
def test_an_anilist_id_reaches_the_anilist_provider(monkeypatch: pytest.MonkeyPatch) -> None:
anilist = FakeProvider(
"anilist",
@@ -192,9 +189,6 @@ def test_anilist_combines_with_a_western_id(monkeypatch: pytest.MonkeyPatch) ->
assert result.external_ids.anilist_id == 21
# ---------- the anime hint ----------
def test_anime_puts_anilist_first_with_the_rest_behind_it() -> None:
ordered = [cls.NAME for cls in providers.provider_order("tv", anime=True)]
assert ordered[0] == "anilist"
-3
View File
@@ -194,9 +194,6 @@ def test_get_episodes_does_not_cache_an_empty_listing(monkeypatch: pytest.Monkey
assert p._episodes == {}
# --- apply_tvdb_order over multi-part episodes -------------------------------
class _Svc:
pass
@@ -82,9 +82,6 @@ def selected(result: Dict[str, Any]) -> List[str]:
return keys
# ---------- serialize_title: the JSON contract ----------
def test_partless_episode_json_has_no_part_key() -> None:
d = serialize_title(ep(part=None))
assert "part" not in d
@@ -137,9 +134,6 @@ def test_movie_json_unaffected() -> None:
assert "part" not in d
# ---------- list_tracks_handler: the REST wanted filter ----------
@pytest.fixture
def split_titles() -> List[Episode]:
"""E1 split into three parts, E2 unsplit."""
@@ -172,9 +166,6 @@ def test_rest_part_of_unsplit_episode_selects_nothing(monkeypatch, split_titles)
assert result["status"] == 404
# ---------- discrete season/episode/part request fields ----------
def test_discrete_fields_without_part_select_every_part(monkeypatch, split_titles) -> None:
result = run_list_tracks(monkeypatch, split_titles, season=1, episode=1)
assert selected(result) == ["1x1.1", "1x1.2", "1x1.3"]
@@ -207,18 +198,12 @@ def test_part_is_a_transport_key_not_a_service_option() -> None:
assert "part" in handlers.SESSION_TRANSPORT_KEYS
# ---------- ordering ----------
def test_rest_multi_episode_order_is_stable_across_parts(monkeypatch) -> None:
titles = [ep(1, 2, None), ep(1, 1, 3), ep(1, 1, 1), ep(1, 1, 2)]
result = run_list_tracks(monkeypatch, titles, wanted="S01")
assert selected(result) == ["1x1.1", "1x1.2", "1x1.3", "1x2"]
# ---------- download_manager: already-internal wanted sniff ----------
SNIFF = r"^!?\d+x\d+(\.\d+)?$"
@@ -283,9 +268,6 @@ def test_perform_download_still_converts_cli_style_tokens(monkeypatch) -> None:
assert params["wanted"] == ["1x1"]
# ---------- CLI / REST agreement ----------
def test_dl_and_handlers_share_the_one_match_helper() -> None:
"""Both filters must route through Episode.matches_wanted, or they drift."""
from pathlib import Path
@@ -49,9 +49,6 @@ def _movie(**overrides: Any) -> Movie:
return Movie(**base)
# ---------- serialize_title: the new conditional keys ----------
NEW_KEYS = ("air_date", "absolute", "daily", "anime")
@@ -94,9 +91,6 @@ def test_a_movie_carries_the_anime_flag_but_never_daily() -> None:
assert "daily" not in d
# ---------- the service-class ANIME/DAILY stamp ----------
class _AnimeDailySvc:
ANIME = True
DAILY = True
@@ -149,9 +143,6 @@ def test_list_titles_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch) -
assert (title["anime"], title["daily"]) == (True, True)
# ---------- round trips through build_title ----------
def round_trip(episode: Episode, stamp: Optional[Any] = None) -> Episode:
info = serialize_title(episode)
if stamp is not None:
@@ -196,9 +187,6 @@ def test_a_movie_round_trip_keeps_the_anime_flag() -> None:
assert rebuilt.anime is True
# ---------- round trips through title_to_meta (the export/import path) ----------
def test_title_to_meta_omits_the_new_keys_for_a_plain_episode() -> None:
meta = dl.title_to_meta(ep())
assert not [k for k in ("absolute", "daily", "anime") if k in meta]
@@ -21,9 +21,6 @@ from unshackle.core.api.errors import APIError, APIErrorCode
pytestmark = pytest.mark.unit
# ---------- redaction ----------
def test_redact_parameters_masks_secrets_and_proxy_userinfo():
params = {
"service": "ATV",
@@ -85,9 +82,6 @@ def test_to_dict_full_details_redacts_error_fields_and_parameters():
assert d["parameters"]["credential"] == "***"
# ---------- gates ----------
class _PastGate(Exception):
"""Raised by the stubbed Services.load to prove a request got past the gate into the try block."""
@@ -140,9 +134,6 @@ async def test_credential_allowed_when_enabled(stub_handler):
assert isinstance(resp, web.Response)
# ---------- range validation ----------
def test_range_validation_accepts_hdr10p_and_alias():
# canonical "HDR10P" and back-compat "HDR10+" both pass; mixed casing too
assert handlers.validate_download_parameters({"range": ["HDR10P", "DV", "SDR"]}) is None
-1
View File
@@ -142,7 +142,6 @@ def test_handle_api_exception_categorizes_generic() -> None:
assert body["error_code"] == "NETWORK_ERROR"
# --- Error contract harness (PRD 05 gate) ---------------------------------
# Locks the FULL observable response — (http status, error_code, retryable) — that
# a client sees for a generic (non-APIError) exception flowing through the
# handle_api_exception funnel that every route's `except Exception` path calls.
@@ -77,9 +77,6 @@ def subtitle(**overrides) -> Subtitle:
return Subtitle(**base)
# ---------- sanitize_log ----------
@pytest.mark.parametrize(
"raw, expected",
[
@@ -93,9 +90,6 @@ def test_sanitize_log(raw, expected: str) -> None:
assert sanitize_log(raw) == expected
# ---------- serialize_title ----------
def test_serialize_title_movie() -> None:
movie = Movie(id_="movie-0001", service=_FakeSvc, name="Title X", year=2024, language=Language.get("en"))
d = serialize_title(movie)
@@ -140,9 +134,6 @@ def test_serialize_title_episode_unnamed_falls_back_to_number() -> None:
assert d["name"] == "Episode 05"
# ---------- serialize_video/audio/subtitle ----------
def test_serialize_video_track_basic() -> None:
d = serialize_video_track(video())
assert d["id"] == "video-001"
@@ -179,9 +170,6 @@ def test_serialize_subtitle_track_basic() -> None:
assert d["cc"] is False
# ---------- serialize_drm ----------
def test_serialize_drm_none_returns_none() -> None:
assert serialize_drm(None) is None
assert serialize_drm([]) is None
@@ -224,16 +212,10 @@ def test_serialize_drm_playready_pssh_without_dumps_is_omitted() -> None:
assert info["kids"] == ["00112233445566778899aabbccddeeff"]
# ---------- validate_service ----------
def test_validate_service_unknown_returns_none() -> None:
assert validate_service("NOPE_THIS_IS_NOT_REAL_") is None
# ---------- validate_download_parameters ----------
def test_validate_download_params_accepts_defaults() -> None:
assert validate_download_parameters({}) is None
-1
View File
@@ -19,7 +19,6 @@ from unshackle.core.api.progress import (
pytestmark = pytest.mark.unit
# --- lightweight track stand-ins (label/weight key off class name + attributes) ---
class _Range:
def __init__(self, value):
self.value = value
-25
View File
@@ -58,11 +58,6 @@ def ids(tracks: list[Video]) -> set[str]:
return {t.id for t in tracks}
# ---------------------------------------------------------------------------
# select_hybrid
# ---------------------------------------------------------------------------
def test_select_hybrid_picks_base_per_resolution_and_lowest_dv(ladder: list[Video]) -> None:
chosen = list(filter(Tracks().select_hybrid(ladder, [2160, 1080]), ladder))
# HDR10+ base at each requested resolution, plus the single lowest DV ingredient.
@@ -107,11 +102,6 @@ def test_select_hybrid_no_dv_selects_only_base() -> None:
assert ids(chosen) == {"hdr10p-2160"}
# ---------------------------------------------------------------------------
# merge_video_selections (the dedup fix)
# ---------------------------------------------------------------------------
def test_merge_dedups_shared_ingredient_and_deliverable() -> None:
H = Video.Codec.HEVC
dv = make_video("dv-1080", range_=Video.Range.DV, height=1080, bitrate=9_000_000, codec=H)
@@ -141,11 +131,6 @@ def test_merge_dedup_uses_track_identity_by_id() -> None:
assert len(Tracks.merge_video_selections([a], [b])) == 1
# ---------------------------------------------------------------------------
# partition_hybrid_videos
# ---------------------------------------------------------------------------
def test_partition_hybrid_only_keeps_ingredients_out_of_pool(ladder: list[Video]) -> None:
"""`-r HYBRID`: HDR10+/DV are ingredients only; pool holds just SDR."""
candidates, pool = Tracks.partition_hybrid_videos(ladder, [])
@@ -178,11 +163,6 @@ def test_partition_hdr10_requested_does_not_admit_hdr10p() -> None:
assert ids(pool) == {"hdr10-2160"}
# ---------------------------------------------------------------------------
# flag_hybrid_ingredients
# ---------------------------------------------------------------------------
def flagged(tracks: list[Video]) -> set[str]:
return {t.id for t in tracks if t.hybrid_base_only}
@@ -228,11 +208,6 @@ def test_flag_single_dv_rendition_as_deliverable_stays_unflagged() -> None:
assert flagged(tracks) == {"hdr10p-1080"}
# ---------------------------------------------------------------------------
# documented end-state for the reported command
# ---------------------------------------------------------------------------
def test_hybrid_plus_dv_deliverable_end_state(ladder: list[Video]) -> None:
"""`-r SDR,HDR10P,DV,HYBRID -q 2160,1080`: hybrid base + lowest DV ingredient,
de-duplicated against the best-DV-per-resolution deliverables and SDR."""
+2 -18
View File
@@ -67,9 +67,6 @@ def cue_count(path) -> int:
return len(re.findall(r"-->", path.read_text("utf8")))
# --- capability matrix / resolver -------------------------------------------------------
def test_resolve_webvtt_to_srt_order():
chain = [b.name for b in sc.resolve_backends(Codec.WebVTT, Codec.SubRip)]
assert chain == ["subby", "pysubs2", "pycaption"]
@@ -131,9 +128,6 @@ def test_no_backend_for_unsupported_target_raises(tmp_path):
sub.convert(Codec.fVTT, forced=True) # no backend writes segmented fVTT
# --- styled-ASS protection --------------------------------------------------------------
def test_ass_to_srt_kept_as_is_when_not_forced(tmp_path, monkeypatch):
monkeypatch.setattr("unshackle.core.config.config.subtitle", {}, raising=False)
sub = make_sub(tmp_path, "x.ass", ASS_SAMPLE, Codec.SubStationAlphav4)
@@ -153,9 +147,6 @@ def test_ass_to_srt_converts_when_forced(tmp_path, monkeypatch):
assert "{\\" not in out.read_text("utf8") # override tags stripped
# --- conversion paths -------------------------------------------------------------------
def test_webvtt_to_srt_conversion(tmp_path, monkeypatch):
monkeypatch.setattr("unshackle.core.config.config.subtitle", {}, raising=False)
sub = make_sub(tmp_path, "x.vtt", VTT_SAMPLE, Codec.WebVTT)
@@ -170,8 +161,6 @@ def test_same_codec_is_noop(tmp_path):
assert sub.codec == Codec.SubRip
# --- ASS/SSA font detection ------------------------------------------------------------
FONT_ASS = """[Script Info]
ScriptType: v4.00+
@@ -205,8 +194,6 @@ def test_extract_fonts_handles_non_default_column_order():
assert Subtitle.extract_fonts(ass) == {"Verdana"}
# --- non-Latin scripts (RTL / CJK) preserved through conversion ------------------------
CJK_RTL_VTT = """WEBVTT
1
@@ -236,8 +223,6 @@ def test_non_latin_scripts_survive_vtt_to_srt(tmp_path, monkeypatch, pattern):
assert re.search(pattern, text) # script survived the round-trip, no mojibake
# --- SDH stripping ----------------------------------------------------------------------
SDH_SRT = """1
00:00:01,000 --> 00:00:02,000
[door creaks]
@@ -293,9 +278,8 @@ def test_sdh_stripping_ass_without_subtitleedit_content_matches_codec(tmp_path,
assert "door creaks" not in text # bracketed effect removed
# --- segmented (box-encapsulated) formats: fVTT (wvtt) / fTTML (stpp) --------------------
# These ship from DASH/HLS as fragmented MP4 (e.g. HBO Max). The downloader concatenates
# init + media segments into one file; parse() reads the MP4 boxes directly.
# Segmented fVTT (wvtt) / fTTML (stpp) ship from DASH/HLS as fragmented MP4 (e.g. HBO Max). The
# downloader concatenates init + media segments into one file; parse() reads the MP4 boxes directly.
FIXTURES = pathlib.Path(__file__).parent / "fixtures"
@@ -55,9 +55,7 @@ def make_audio(
)
# ---------------------------------------------------------------------------
# by_resolutions: width=None must not crash the canvas fallback
# ---------------------------------------------------------------------------
def test_by_resolutions_tolerates_width_none_track() -> None:
@@ -73,9 +71,7 @@ def test_by_resolutions_tolerates_width_none_track() -> None:
assert [t.id for t in tracks.videos] == ["canvas-720"]
# ---------------------------------------------------------------------------
# sort_videos: resolution before bitrate
# ---------------------------------------------------------------------------
def test_sort_videos_resolution_outranks_bitrate() -> None:
@@ -102,9 +98,7 @@ def test_sort_videos_unknown_bitrate_still_wins_on_resolution() -> None:
assert [t.id for t in tracks.videos] == ["unknown-1080", "known-720"]
# ---------------------------------------------------------------------------
# sort_audio: first track after sort is the "best" the dl layer picks
# ---------------------------------------------------------------------------
def test_sort_audio_atmos_ranks_first() -> None: