mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 11:25:08 +00:00
refactor(core)!: drop leading underscores from internal definitions
Renames 314 defs and 41 module/class-level constants. Keeps 11 names underscored where the stripped form collides in scope, plus 5.5.0 shims for the three symbols external service repos call.
This commit is contained in:
@@ -47,7 +47,7 @@ def reset_template():
|
||||
|
||||
def test_air_date_replaces_season_episode_dotted(reset_template):
|
||||
ep = make_episode(air_date=date(2024, 6, 30))
|
||||
ctx = ep._build_template_context(StubMediaInfo())
|
||||
ctx = ep.build_template_context(StubMediaInfo())
|
||||
assert ctx["season_episode"] == "2024.06.30"
|
||||
assert ctx["season"] == "2024.06.30"
|
||||
assert ctx["episode"] == ""
|
||||
@@ -58,19 +58,19 @@ def test_air_date_replaces_season_episode_dotted(reset_template):
|
||||
def test_air_date_uses_space_separator(reset_template):
|
||||
reset_template.output_template = {"series": "{title} {season_episode} {quality}-{tag}"}
|
||||
ep = make_episode(air_date=date(2024, 6, 30))
|
||||
assert ep._build_template_context(StubMediaInfo())["season_episode"] == "2024 06 30"
|
||||
assert ep.build_template_context(StubMediaInfo())["season_episode"] == "2024 06 30"
|
||||
|
||||
|
||||
def test_iso_string_air_date_coerced(reset_template):
|
||||
ep = make_episode(air_date="2024-06-30")
|
||||
assert isinstance(ep.air_date, date)
|
||||
assert ep._build_template_context(StubMediaInfo())["season_episode"] == "2024.06.30"
|
||||
assert ep.build_template_context(StubMediaInfo())["season_episode"] == "2024.06.30"
|
||||
|
||||
|
||||
def test_year_always_dropped_in_file_when_dated(reset_template):
|
||||
"""The air date is the sole date in the filename; a distinct year is dropped too (deterministic)."""
|
||||
ep = make_episode(year=2010, air_date=date(2013, 10, 30))
|
||||
ctx = ep._build_template_context(StubMediaInfo())
|
||||
ctx = ep.build_template_context(StubMediaInfo())
|
||||
assert ctx["year"] == ""
|
||||
assert ctx["season_episode"] == "2013.10.30"
|
||||
|
||||
@@ -78,7 +78,7 @@ def test_year_always_dropped_in_file_when_dated(reset_template):
|
||||
def test_yearless_title_takes_year_from_date(reset_template):
|
||||
"""A title with no year still names cleanly; the date supplies the year."""
|
||||
ep = make_episode(year=None, air_date=date(2026, 6, 28))
|
||||
ctx = ep._build_template_context(StubMediaInfo())
|
||||
ctx = ep.build_template_context(StubMediaInfo())
|
||||
assert ctx["year"] == ""
|
||||
assert ctx["season_episode"] == "2026.06.28"
|
||||
|
||||
@@ -87,13 +87,13 @@ def test_datetime_normalized_to_date(reset_template):
|
||||
"""A datetime (subclass of date) must not leak its time into the {date} token."""
|
||||
ep = make_episode(air_date=datetime(2024, 6, 30, 13, 0, 0))
|
||||
assert type(ep.air_date) is date
|
||||
assert ep._build_template_context(StubMediaInfo())["date"] == "2024-06-30"
|
||||
assert ep.build_template_context(StubMediaInfo())["date"] == "2024-06-30"
|
||||
|
||||
|
||||
def test_no_air_date_is_unchanged(reset_template):
|
||||
"""Regression: without air_date, naming is exactly as before (presentation-only field)."""
|
||||
ep = make_episode()
|
||||
ctx = ep._build_template_context(StubMediaInfo())
|
||||
ctx = ep.build_template_context(StubMediaInfo())
|
||||
assert ctx["season_episode"] == "S2024E181"
|
||||
assert ctx["season"] == "S2024"
|
||||
assert ctx["episode"] == "E181"
|
||||
|
||||
Reference in New Issue
Block a user