"""Tests für die Playlist-Generierung.""" from pathlib import Path from musiksammlung.models import Album, Disc, Track from musiksammlung.playlist import generate_playlist def test_generate_playlist_single_disc(tmp_path: Path): """Erzeugt eine M3U-Playlist für ein Single-CD-Album.""" album = Album( artist="Artist", album="TestAlbum", year=2000, discs=[ Disc( disc_number=1, tracks=[ Track(track_number=1, title="Song Eins"), Track(track_number=2, title="Song Zwei"), ], ) ], ) # Dummy-Audiodateien anlegen (tmp_path / "01 Song Eins.flac").touch() (tmp_path / "02 Song Zwei.flac").touch() playlist_path = generate_playlist(album, tmp_path) assert playlist_path.exists() content = playlist_path.read_text() assert "#EXTM3U" in content assert "01 Song Eins.flac" in content assert "02 Song Zwei.flac" in content # Kein CD-Prefix bei Single-Disc assert "CD1/" not in content