Skip to content

Commit

Permalink
add failing find_match() test for internetarchive#9808 and internetar…
Browse files Browse the repository at this point in the history
  • Loading branch information
hornc committed Sep 2, 2024
1 parent 5f293be commit 81dfd5f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions openlibrary/catalog/add_book/tests/test_add_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from openlibrary.catalog.add_book import (
build_pool,
editions_matched,
find_match.
IndependentlyPublished,
isbns_from_record,
load,
Expand Down Expand Up @@ -1750,3 +1751,28 @@ def test_year_1900_removed_from_amz_and_bwb_promise_items(self, rec, expected):
"""
normalize_import_record(rec=rec)
assert rec == expected


def test_find_match_title_only_promiseitem_against_noisbn_marc(mock_site):
# An existing light title + ISBN only record
existing_edition = {
'key': '/books/OL113M',
# NO author
# NO date
# NO publisher
'title': 'Just A Title',
'isbn_13': ['9780000000002'],
'source_records': ['promise:someid'],
'type': {'key': '/type/edition'},
}
marc_import = {
'authors': [{'name': 'Bob Smith'}],
'publish_date': '1913',
'publishers': ['Early Editions'],
'title': 'Just A Title',
'source_records': ['marc:somelibrary/some_marc.mrc'],
}
mock_site.save(existing_edition)
result = find_match(marc_import, {'title': [existing_edition['key']]})
assert result is not '/books/OL113M'
assert result is None

0 comments on commit 81dfd5f

Please sign in to comment.