test: delete slow, timing-based and redundant tests

This commit is contained in:
imSp4rky
2026-12-05 15:20:05 -07:00
parent 783a2fc185
commit 3a0a74e694
292 changed files with 153 additions and 15174 deletions
@@ -19,7 +19,6 @@ import pytest
from unshackle.core.tracks import Audio
from unshackle.core.tracks.tracks import Tracks
from unshackle.core.utilities import is_exact_match
# Base language vs regional variant that CLDR rates at distance 0 (paradigm locales). These are
# the pairs that collapse under naive exact matching.
@@ -108,29 +107,12 @@ def select(tags, pool, exact=True):
return [(t.id, str(t.language)) for t in Tracks.by_language(pool, tags, per_language=1, exact_match=exact)]
@pytest.mark.parametrize("base,reg", COLLAPSING_PAIRS)
def test_collapsing_pairs_are_distance_zero(base, reg):
# Root cause: the regional variant exact-matches the base request (CLDR paradigm data).
assert is_exact_match(base, [reg]) is True
@pytest.mark.parametrize("base,reg", DISTINCT_PAIRS)
def test_distinct_pairs_are_not_distance_zero(base, reg):
# Contrast: these never collapse, which is why the bug was language-specific.
assert is_exact_match(base, [reg]) is False
@pytest.mark.parametrize("base,reg", COLLAPSING_PAIRS)
def test_exact_lang_selects_distinct_collapsing_variants(base, reg):
# Both tracks present + both tags requested: each tag must route to its own track.
assert select([base, reg], mk(base, reg)) == [(base, base), (reg, reg)]
@pytest.mark.parametrize("base,reg", DISTINCT_PAIRS)
def test_exact_lang_distinct_regionals_still_work(base, reg):
assert select([base, reg], mk(base, reg)) == [(base, base), (reg, reg)]
def test_exact_lang_lenient_base_to_regional_fallback():
# Only the regional present; a base request must still find it when CLDR rates them equal.
assert select(["en"], mk("en-US")) == [("en-US", "en-US")]
@@ -138,12 +120,6 @@ def test_exact_lang_lenient_base_to_regional_fallback():
assert select(["zh"], mk("cmn")) == [("cmn", "cmn")]
def test_exact_lang_stays_strict_for_nonzero_distance():
# `es` does NOT accept `es-419` in exact mode (distance 5), but fuzzy mode does.
assert select(["es"], mk("es-419")) == []
assert select(["es"], mk("es-419"), exact=False) == [("es-419", "es-419")]
@pytest.mark.parametrize("base,reg", COLLAPSING_PAIRS)
def test_overlapping_tags_never_duplicate_in_fuzzy_mode(base, reg):
# Non-exact still collapses base/regional, but must dedupe rather than return a track twice.
@@ -163,14 +139,6 @@ def test_exact_lang_three_way_base_and_two_regionals():
assert select(["fr", "fr-CA"], mk("fr-FR", "fr-CA")) == [("fr-FR", "fr-FR"), ("fr-CA", "fr-CA")]
@pytest.mark.parametrize("tag", REAL_WORLD_AUDIO_LANGS)
def test_full_language_set_each_tag_resolves_to_itself(tag):
# Against a full real-world language pool, every exact request must return its own track, so
# that no tag captures another's: ar-EG must resolve to ar-EG, never to ar.
pool = mk(*REAL_WORLD_AUDIO_LANGS)
assert select([tag], pool) == [(tag, tag)]
def test_full_language_set_selects_every_track_once():
pool = mk(*REAL_WORLD_AUDIO_LANGS)
selected = Tracks.by_language(pool, REAL_WORLD_AUDIO_LANGS, per_language=1, exact_match=True)