Content-Length: 251115 | pFad | http://github.com/internetarchive/openlibrary/commit/f92c2f3fca5bc4d4d2379af44e20c6ee23110662

27 tidy existing match tests · internetarchive/openlibrary@f92c2f3 · GitHub
Skip to content

Commit

Permalink
tidy existing match tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hornc committed Feb 18, 2025
1 parent 475cf82 commit f92c2f3
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions openlibrary/catalog/add_book/tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,32 +173,6 @@ def test_expand_record_isbn(self):


class TestAuthors:
@pytest.mark.xfail(
reason=(
'This expected result taken from the amazon and '
'merge versions of compare_author, '
'Current merge_marc.compare_authors() '
'does NOT take by_statement into account.'
)
)
def test_compare_authors_by_statement(self):
rec1 = {
'title': 'Full Title, required',
'authors': [{'name': 'Alistair Smith'}],
}
rec2 = {
'title': 'A different Full Title, only matching authors here.',
'authors': [
{
'name': 'National Gallery (Great Britain)',
'entity_type': 'org',
}
],
'by_statement': 'Alistair Smith.',
}
result = compare_authors(expand_record(rec1), expand_record(rec2))
assert result == ('main', 'exact match', 125)

def test_author_contrib(self):
rec1 = {
'authors': [{'name': 'Bruner, Jerome S.'}],
Expand All @@ -218,7 +192,6 @@ def test_author_contrib(self):
)
}
],
# TODO: the contrib db_name needs to be populated by expand_record() to be useful
'contribs': [{'name': 'Bruner, Jerome S.', 'db_name': 'Bruner, Jerome S.'}],
'title': 'Contemporary approaches to cognition ',
'subtitle': 'a symposium held at the University of Colorado',
Expand All @@ -233,8 +206,7 @@ def test_author_contrib(self):
'exact match',
125,
)
threshold = 875
assert threshold_match(rec1, rec2, threshold) is True
assert threshold_match(rec1, rec2, THRESHOLD) is True


class TestTitles:
Expand Down Expand Up @@ -342,8 +314,7 @@ def test_match_without_ISBN(self):
'exact match',
125,
)
threshold = 875
assert threshold_match(bpl, lc, threshold) is True
assert threshold_match(bpl, lc, THRESHOLD) is True

def test_match_low_threshold(self):
# year is off by < 2 years, counts a little
Expand Down

0 comments on commit f92c2f3

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/internetarchive/openlibrary/commit/f92c2f3fca5bc4d4d2379af44e20c6ee23110662

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy