From 8fafb937aa631dcb766cd69c41a5d56d9bf17045 Mon Sep 17 00:00:00 2001 From: Lucas Vivo Date: Sun, 22 Nov 2026 19:51:29 +0100 Subject: [PATCH] test(audiobook_library): test series and number recognition --- audiobook_library/test/test_audiobook.py | 26 +++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/audiobook_library/test/test_audiobook.py b/audiobook_library/test/test_audiobook.py index 2a8cc39..e92aea7 100644 --- a/audiobook_library/test/test_audiobook.py +++ b/audiobook_library/test/test_audiobook.py @@ -149,18 +149,30 @@ class AudiobookTests(unittest.TestCase): 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", - } + 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"), + ("Jack Reacher 10 - The Hard Way", "10"), + ("Jack Reacher #10: The Hard Way", "10"), + ("Jack Reacher - #10 - The Hard Way", "10"), + ("Jack Reacher - 10 - The Hard Way", "10"), + ("Jack Reacher - Book 10 - The Hard Way", "10"), + ("Jack Reacher Book 10 - The Hard Way", "10"), + ("Jack Reacher: Book 10: The Hard Way", "10"), + ("Jack Reacher - Band 10 - The Hard Way", "10"), + ("Jack Reacher - Volume 10 - The Hard Way", "10"), + ("Jack Reacher - Vol 10 - The Hard Way", "10"), + ("Jack Reacher - Book 10", "10"), + ("10 - The Hard Way", "10"), + ("Jack Reacher - 10", "10"), + ] - for path_name, number in examples.items(): + for path_name, number in examples: 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()