Skip to content

Commit

Permalink
added unit test for the case of a non-ArXiv eprint match
Browse files Browse the repository at this point in the history
 	new file:   adsdocmatch/tests/unittests/stubdata/L48-23288.abs
 	modified:   adsdocmatch/tests/unittests/test_match_w_metadata.py
  • Loading branch information
seasidesparrow committed Dec 13, 2023
1 parent f4668df commit 6c65435
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
15 changes: 15 additions & 0 deletions adsdocmatch/tests/unittests/stubdata/L48-23288.abs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Title: Native H2 exploration in the western Pyrenean
foothills
Authors: Lefeuvre, Nicolas; Truche, Laurent;
Donze, Frederic Victor; Ducoux, Maxime;
Barré, Guillaume; Fakoury, Rose-Adeline;
Calassou, Sylvain; Gaucher, Eric
Journal: ESS Open Archive, id. essoar.10507102.1
Publication Date: 05/2021
Category: Earth Science
Origin: ESSOAR
DOI: 10.1002/essoar.10507102.1
Bibliographic Code: 2021esoar.10507102L

Abstract
Not Available
24 changes: 24 additions & 0 deletions adsdocmatch/tests/unittests/test_match_w_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ def test_match_to_pub_4(self):
for i in range(len(fields)):
self.assertEqual(fields[i], expected_value[i])

def test_es_match_to_pub_1(self):
""" test match_to_pub using a non-ArXiv, Earth Science preprint"""

return_value = [{
'source_bibcode': '2021esoar.10507102L',
'matched_bibcode': '2021GGG....2209917L',
'label': 'Match',
'confidence': 0.9981487,
'score': {'abstract': None, 'title': 0.95, 'author': 1, 'year': 1},
'comment': ''
}]
is_ArXiv = False
with mock.patch.object(self.match_metadata.ORACLE_UTIL, 'get_matches', return_value=return_value):
matches = self.match_metadata.single_match_to_pub(filename=os.path.dirname(__file__) + '/stubdata/L48-23288.abs', is_ArXiv=is_ArXiv)
self.assertEqual(len(matches), 1)
fields = matches[0].split('\t')
self.assertEqual(len(fields), 6)
self.assertEqual(fields[0], '2021esoar.10507102L')
self.assertEqual(fields[1], '2021GGG....2209917L')
self.assertEqual(fields[2], 'Match')
self.assertEqual(fields[3], '0.9981487')
self.assertEqual(fields[4], "{'abstract': None, 'title': 0.95, 'author': 1, 'year': 1}")
self.assertEqual(fields[5], '')

def test_batch_match_to_pub(self):
""" test batch mode of match_to_pub """

Expand Down

0 comments on commit 6c65435

Please sign in to comment.