add program files

This commit is contained in:
2025-11-16 10:00:56 +01:00
parent 4a019c37c2
commit 4519d722bc
23 changed files with 1205 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
from __future__ import annotations
from pathlib import Path
from audiobooksorter.cli import _format_dry_run
from audiobooksorter.ingest import load_library
from audiobooksorter.sorter import sort_by_series
def test_loads_directory_without_metadata_files() -> None:
records = load_library(Path("testdata"))
assert len(records) == 14
series_names = {record.series for record in records}
assert {"All the Skills", "Battle Mage Farmer", "The Wandering Inn"} <= series_names
battle_indexes = sorted(
record.series_index for record in records if record.series == "Battle Mage Farmer"
)
assert battle_indexes == [1.0, 2.0, 3.0, 4.0]
def test_dry_run_formats_preview() -> None:
records = sort_by_series(load_library(Path("testdata")))
preview = _format_dry_run(records)
assert "Dry run (no files written)" in preview
assert "Seth Ring / Battle Mage Farmer" in preview
assert "Seth Ring / Battle Mage Farmer / Book 1" in preview
assert "PirateAba / The Wandering Inn" in preview
assert "PirateAba / The Wandering Inn / Book 1" in preview