2812695465
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
826 B
Python
25 lines
826 B
Python
from lyra_worker.library import album_dir, safe_name
|
|
from lyra_worker.types import MBTarget
|
|
|
|
|
|
def test_safe_name_replaces_illegal_chars():
|
|
assert safe_name("AC/DC") == "AC_DC"
|
|
assert safe_name('a:b*c?"') == "a_b_c__"
|
|
assert safe_name(" .Trailing. ") == "Trailing"
|
|
assert safe_name("") == "Unknown"
|
|
|
|
|
|
def test_album_dir_with_year():
|
|
t = MBTarget(artist="John Mayer", album="Continuum", year=2006)
|
|
assert album_dir("/music", t) == "/music/John Mayer/Continuum (2006)"
|
|
|
|
|
|
def test_album_dir_without_year():
|
|
t = MBTarget(artist="John Mayer", album="Continuum")
|
|
assert album_dir("/music", t) == "/music/John Mayer/Continuum"
|
|
|
|
|
|
def test_album_dir_sanitizes():
|
|
t = MBTarget(artist="AC/DC", album="Back in Black", year=1980)
|
|
assert album_dir("/music", t) == "/music/AC_DC/Back in Black (1980)"
|