Skip to content

Commit

Permalink
scoap3-next: arxiv id parsing to str before extracting categories (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestaP authored May 30, 2023
1 parent 8c6afcc commit a655c70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scoap3/utils/arxiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def clean_arxiv(arxiv):
if arxiv is None:
return None

return arxiv.split(':')[-1].split('v')[0].split(' ')[0].strip('"\'')
return str(arxiv.split(':')[-1].split('v')[0].split(' ')[0].strip('"\''))


def get_arxiv_categories_from_response_xml(xml):
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/utils/test_arxiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,8 @@ def test_categories_without_arxiv_with_title_and_doi():
categories = get_arxiv_categories(doi="10.1088/1674-1137/acac6c", title="Static properties and Semileptonic transitions of lowest-lying double heavy baryons")
assert categories == ['hep-ph']

@mark.vcr
def test_categories_with_arxiv_type_unicode():
"""Test extraction arXiv categories from arXiv api."""
categories = get_arxiv_categories(arxiv_id=u'2111.13053', title="Axial Chiral Vortical Effect in a Sphere with finite size effect", doi="10.1088/1674-1137/acac6d")
assert categories == ['hep-th']

0 comments on commit a655c70

Please sign in to comment.