Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding independent publisher check #9917

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading