mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-14 21:15:06 +00:00
refactor(tracks): honour the best token and share one match rule
sort_subtitles resolved only the all token, while the video and audio sorts resolved all and best. by_language now asks matching_languages rather than repeating the RFC 4647 preference, with no behaviour change.
This commit is contained in:
@@ -180,11 +180,18 @@ def test_no_priority_leaves_order_unchanged(many: Tracks) -> None:
|
||||
assert langs(many) == ["ar", "bg", "en", "es", "fr", "ja"]
|
||||
|
||||
|
||||
def test_all_alone_still_floats_the_original_language(many: Tracks) -> None:
|
||||
many.sort_subtitles(by_language=["all"], group_by="language")
|
||||
@pytest.mark.parametrize("token", ["all", "best"])
|
||||
def test_magic_token_alone_floats_the_original_language(many: Tracks, token: str) -> None:
|
||||
many.sort_subtitles(by_language=[token], group_by="language")
|
||||
assert langs(many) == ["ja", "ar", "bg", "en", "es", "fr"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("token", ["all", "best"])
|
||||
def test_priority_outranks_either_magic_token(many: Tracks, token: str) -> None:
|
||||
many.sort_subtitles(by_language=["en", "es", token], group_by="language")
|
||||
assert langs(many) == ["en", "es", "ja", "ar", "bg", "fr"]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def regionals() -> Tracks:
|
||||
t = Tracks()
|
||||
|
||||
Reference in New Issue
Block a user