forked from kenzuya/unshackle
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -46,14 +46,6 @@ def reset_template():
|
||||
config.output_template, config.folder_templates, config.folder_template, config.tag = saved
|
||||
|
||||
|
||||
def test_absolute_defaults_to_none():
|
||||
assert make_episode().absolute is None
|
||||
|
||||
|
||||
def test_int_absolute_is_kept():
|
||||
assert make_episode(absolute=27).absolute == 27
|
||||
|
||||
|
||||
def test_digit_string_absolute_coerces():
|
||||
assert make_episode(absolute="27").absolute == 27
|
||||
|
||||
@@ -70,12 +62,6 @@ def test_non_int_absolute_rejected(bad):
|
||||
make_episode(absolute=bad)
|
||||
|
||||
|
||||
def test_bool_absolute_rejected():
|
||||
"""bool is an int subclass; True would render as '001' in filenames."""
|
||||
with pytest.raises(TypeError):
|
||||
make_episode(absolute=True)
|
||||
|
||||
|
||||
def test_old_cache_entry_reads_as_absolute_less():
|
||||
"""jsonpickle restores by populating __dict__; an older entry has no 'absolute' key."""
|
||||
restored = Episode.__new__(Episode)
|
||||
@@ -87,14 +73,6 @@ def test_absolute_token_is_three_wide(reset_template):
|
||||
assert make_episode(absolute=7).build_template_context(StubMediaInfo())["absolute"] == "007"
|
||||
|
||||
|
||||
def test_absolute_token_does_not_truncate_past_three_digits(reset_template):
|
||||
assert make_episode(absolute=1042).build_template_context(StubMediaInfo())["absolute"] == "1042"
|
||||
|
||||
|
||||
def test_absolute_token_is_empty_without_a_value(reset_template):
|
||||
assert make_episode().build_template_context(StubMediaInfo())["absolute"] == ""
|
||||
|
||||
|
||||
def test_filename_renders_the_absolute_number(reset_template):
|
||||
assert make_episode(absolute=7).get_filename(StubMediaInfo()) == "The.Show.S01E01.007.DummyService-GROUP"
|
||||
|
||||
@@ -105,11 +83,6 @@ def test_optional_absolute_token_drops_out(reset_template):
|
||||
assert make_episode(absolute=7).get_filename(StubMediaInfo()) == "The.Show.S01E01.007.DummyService-GROUP"
|
||||
|
||||
|
||||
def test_absolute_is_a_known_template_variable(reset_template, recwarn):
|
||||
reset_template.validate_output_templates()
|
||||
assert not [w for w in recwarn.list if "absolute" in str(w.message)]
|
||||
|
||||
|
||||
def test_str_and_sorting_ignore_the_absolute_number():
|
||||
assert str(make_episode(absolute=7)) == "The Show S01E01 The Reckoning"
|
||||
series = Series([make_episode(number=2, absolute=1), make_episode(number=1, absolute=2)])
|
||||
@@ -164,42 +137,3 @@ def test_a_service_already_in_absolute_order_fills_from_its_own_numbers(monkeypa
|
||||
titles, fake, _ = fill(monkeypatch, episodes, {}, order="absolute")
|
||||
assert [t.absolute for t in titles] == [26, 27]
|
||||
assert fake.orders == []
|
||||
|
||||
|
||||
def test_fill_never_touches_season_or_number(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=2, number=1)]
|
||||
titles, _, _ = fill(monkeypatch, episodes, MAPPING)
|
||||
assert [(t.season, t.number) for t in titles] == [(2, 1)]
|
||||
|
||||
|
||||
def test_a_service_set_absolute_number_wins(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=1, number=1, absolute=99), make_episode(season=1, number=2)]
|
||||
titles, _, _ = fill(monkeypatch, episodes, MAPPING)
|
||||
assert [t.absolute for t in titles] == [99, 2]
|
||||
|
||||
|
||||
def test_an_unmapped_episode_keeps_no_absolute_number(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=9, number=9)]
|
||||
titles, _, _ = fill(monkeypatch, episodes, MAPPING)
|
||||
assert titles[0].absolute is None
|
||||
|
||||
|
||||
def test_fill_skips_silently_without_an_api_key(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=1, number=1)]
|
||||
titles, _, logged = fill(monkeypatch, episodes, MAPPING, provider=False)
|
||||
assert titles[0].absolute is None
|
||||
assert [level for level, _ in logged] == ["debug"]
|
||||
|
||||
|
||||
def test_fill_skips_silently_without_a_tvdb_id(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=1, number=1)]
|
||||
titles, _, logged = fill(monkeypatch, episodes, MAPPING, tvdb_id=None)
|
||||
assert titles[0].absolute is None
|
||||
assert [level for level, _ in logged] == ["debug"]
|
||||
|
||||
|
||||
def test_fill_skips_silently_when_tvdb_has_no_absolute_order(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
episodes = [make_episode(season=1, number=1)]
|
||||
titles, _, logged = fill(monkeypatch, episodes, {})
|
||||
assert titles[0].absolute is None
|
||||
assert [level for level, _ in logged] == ["debug"]
|
||||
|
||||
Reference in New Issue
Block a user