test(audiobook_library): add tests for series extraction
Audiobook Library CI / test (push) Successful in 58s
Audiobook Library CI / lint (push) Successful in 9s
Audiobook Library CI / build (push) Successful in 47s
Audiobook Library CI / install (mediahost) (push) Successful in 1s
Audiobook Library CI / install (vivohost) (push) Successful in 2s
Audiobook Library CI / install (quiethost) (push) Successful in 2s
Audiobook Library CI / install (serverhost) (push) Successful in 4s

This commit is contained in:
Lucas Vivo committed 2026-11-22 19:10:18 +01:00
1 parent 06719968a3
commit 49801263c6
1 file changed
+20
+20
View File
@@ -148,6 +148,26 @@ class AudiobookTests(unittest.TestCase):
book.fix_series() book.fix_series()
self.assertTrue(book.generate_dir_from_metadata()[0].is_relative_to(self.root)) self.assertTrue(book.generate_dir_from_metadata()[0].is_relative_to(self.root))
def test_fix_series_from_series_number_title_path(self):
examples = {
"Jack Reacher 10: The Hard Way (by Dick Hill)": "10",
"Jack Reacher 1: Killing Floor (by Dick Hill)": "1",
"Jack Reacher 28: The Secret (by Jeff Harding)": "28",
}
for path_name, number in examples.items():
with self.subTest(path_name=path_name):
book_dir = self.root / "Author" / path_name
book_dir.mkdir(parents=True)
book = Audiobook(book_dir, self.root)
book.series = "Jack Reacher"
book.series_and_num = "Jack Reacher"
book.fix_series()
self.assertEqual(book.series, "Jack Reacher")
self.assertEqual(book.series_num, number)
self.assertEqual(book.series_and_num, f"Jack Reacher #{number}")
def test_file_operations(self): def test_file_operations(self):
book = self.make_book() book = self.make_book()
destination = self.root / "new" destination = self.root / "new"