Skip to content

Commit

Permalink
adding independent publisher check
Browse files Browse the repository at this point in the history
  • Loading branch information
DebbieSan committed Sep 30, 2024
1 parent 9c4db66 commit 0ab86bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openlibrary/catalog/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ def is_independently_published(publishers: list[str]) -> bool:
"""
Return True if the book is independently published.
"""
independent_publisher_names = ['independently published', 'independent publisher']
return any(
publisher.casefold() == "independently published" for publisher in publishers
publisher.casefold() in independent_publisher_names for publisher in publishers
)


Expand Down
2 changes: 2 additions & 0 deletions openlibrary/tests/catalog/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ def test_publication_too_old_and_not_exempt(name, rec, expected) -> None:
'publishers, expected',
[
(['INDEPENDENTLY PUBLISHED'], True),
(['Independent publisher'], True),
(['Another Publisher', 'independently published'], True),
(['Another Publisher', 'independent publisher'], True),
(['Another Publisher'], False),
],
)
Expand Down

0 comments on commit 0ab86bb

Please sign in to comment.