Rework Curator into a Jellyfin-first library manager
This commit is contained in:
@@ -6,6 +6,7 @@ from src.core.naming import (
|
||||
is_canonical_pool_stem,
|
||||
is_valid_year,
|
||||
parse_pool_stem,
|
||||
parse_tmdb_id,
|
||||
year_from_filename,
|
||||
)
|
||||
|
||||
@@ -46,6 +47,33 @@ def test_parse_pool_stem_non_canonical():
|
||||
assert parse_pool_stem("Matrix 1999") is None
|
||||
|
||||
|
||||
def test_canonical_pool_stem_with_tmdb_id():
|
||||
assert canonical_pool_stem("Matrix", 1999, 603) == "Matrix (1999) [tmdbid-603]"
|
||||
# empty/None id → plain stem, no brackets
|
||||
assert canonical_pool_stem("Matrix", 1999, None) == "Matrix (1999)"
|
||||
assert canonical_pool_stem("Matrix", 1999, "") == "Matrix (1999)"
|
||||
|
||||
|
||||
def test_canonical_pool_stem_rejects_bad_id():
|
||||
with pytest.raises(ValueError):
|
||||
canonical_pool_stem("Matrix", 1999, "tt0133093")
|
||||
|
||||
|
||||
def test_parse_pool_stem_strips_trailing_tmdb_id():
|
||||
# title stays clean; the id is dropped from parse_pool_stem
|
||||
assert parse_pool_stem("Matrix (1999) [tmdbid-603]") == ("Matrix", 1999)
|
||||
|
||||
|
||||
def test_parse_tmdb_id():
|
||||
assert parse_tmdb_id("Matrix (1999) [tmdbid-603]") == 603
|
||||
assert parse_tmdb_id("Matrix (1999)") is None
|
||||
assert parse_tmdb_id("Matrix") is None
|
||||
|
||||
|
||||
def test_is_canonical_accepts_tmdb_id_form():
|
||||
assert is_canonical_pool_stem("Matrix (1999) [tmdbid-603]")
|
||||
|
||||
|
||||
def test_is_canonical_pool_stem():
|
||||
assert is_canonical_pool_stem("Matrix (1999)")
|
||||
assert not is_canonical_pool_stem("Matrix")
|
||||
|
||||
Reference in New Issue
Block a user