diff --git a/services/app/domain/automatic_eligibility.py b/services/app/domain/automatic_eligibility.py index 46e7bc99..56540a2d 100644 --- a/services/app/domain/automatic_eligibility.py +++ b/services/app/domain/automatic_eligibility.py @@ -17,8 +17,8 @@ PARTIAL = re.compile(r"\b(?:sample|excerpt|preview|incomplete|truncated)\d*\b", re.I) DISC_FOLDER = re.compile(r"(?:^|[\s_(\[])(?:cd|disc|disk|part)\s*\d+\b", re.I) PACK = re.compile( - r"\b(collection|pack|omnibus|box[ -]?set|anthology|complete series|" - r"books?\s+\d+\s*[-–]\s*\d+)\b", + r"\b(collection|pack|omnibus|box[ -]?set|anthology|complete series|series by|" + r"books?\s+\d+\s*(?:[-–]|to)\s*\d+)\b", re.I, ) diff --git a/tests/unit/test_pack_coverage.py b/tests/unit/test_pack_coverage.py index 6e47508d..7964c960 100644 --- a/tests/unit/test_pack_coverage.py +++ b/tests/unit/test_pack_coverage.py @@ -263,3 +263,18 @@ def test_target_format_preference_cannot_be_satisfied_by_a_siblings_encoding(): descriptor=files, catalog=CATALOG, ) + + +@pytest.mark.parametrize( + "title", + [ + "The Long Earth Series By Stephen Baxter and Terry Pratchett", + "The Long Earth series, books 1 to 5 - Terry Pratchett & Stephen Baxter", + ], +) +def test_whole_series_names_are_collections(title): + work = {"title": "The Long Earth", "authors": ["Terry Pratchett", "Stephen Baxter"]} + value = release().model_copy( + update={"title": title, "raw_title": title, "authors": work["authors"]} + ) + assert collection_candidate(value, work)