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

OpenAlex DOI lookups with invalid parameters #77

Merged
merged 3 commits into from
Jul 8, 2024
Merged

Conversation

lwrubel
Copy link
Collaborator

@lwrubel lwrubel commented Jul 8, 2024

Resolves #76 to retry DOIs in a batch if one proves invalid (because of a comma or some other issue).

@@ -50,11 +50,20 @@ def test_publications_from_dois():
pubs = list(openalex.publications_from_dois(dois))
assert len(pubs) == 231, "should paginate (page size=200)"
assert len(pubs) == len(set([pub["doi"] for pub in pubs])), "DOIs are unique"
assert set(openalex.FIELDS) == set(pubs[0].keys()), "All fields accounted for."
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to delete this assertion. Fixing.

assert len(pubs[0].keys()) == 51, "first publication has 51 columns"
assert len(pubs[1].keys()) == 51, "second publication has 51 columns"


def test_publications_from_invalid_dois(caplog):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't know about caplog from pytest.

@edsu edsu merged commit 82286d1 into main Jul 8, 2024
1 check passed
@edsu edsu deleted the openalex-doi-lookup branch July 8, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commas in DOIs cause OpenAlex API error
2 participants