Skip to content

Commit

Permalink
Springer parser: test parsed and cleaned orcids
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestaP committed Jul 10, 2024
1 parent fae3149 commit 3e1f0c3
Show file tree
Hide file tree
Showing 2 changed files with 588 additions and 1 deletion.
96 changes: 95 additions & 1 deletion tests/units/springer/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_authors(parsed_articles):

for author in authors:
for aff in author.get("affiliations", []):
if aff.get("country") is "Korea":
if aff.get("country") == "Korea":
aff["country"] = "South Korea"

assert Enhancer()("Springer", parsed_article)["authors"] == authors
Expand Down Expand Up @@ -328,3 +328,97 @@ def test_abstract(parsed_articles):
for abstract, article in zip(abstracts, parsed_articles):
assert "abstract" in article
assert article["abstract"] == abstract


@fixture
def article_with_orcid(parser, datadir):
with open(datadir / "s10052-024-12692-y.xml") as file:
yield parser._generic_parsing(parser._publisher_specific_parsing(ET.fromstring(file.read())))


def test_article_with_cleaned_orcid(article_with_orcid):
print(article_with_orcid["authors"])
expected_output = [
{
"surname": "Hong",
"given_names": "T.",
"email": "[email protected]",
"affiliations": [
{
"value": "An Giang University, Long Xuyen, 880000, Vietnam",
"organization": "An Giang University",
"country": "Vietnam"
},
{
"value": "Vietnam National University, Ho Chi Minh City, 700000, Vietnam",
"organization": "Vietnam National University",
"country": "Vietnam"
}
],
"full_name": "Hong, T."
},
{
"surname": "Tran",
"given_names": "Q.",
"email": "[email protected]",
"affiliations": [
{
"value": "An Giang University, Long Xuyen, 880000, Vietnam",
"organization": "An Giang University",
"country": "Vietnam"
},
{
"value": "Vietnam National University, Ho Chi Minh City, 700000, Vietnam",
"organization": "Vietnam National University",
"country": "Vietnam"
}
],
"full_name": "Tran, Q."
},
{
"surname": "Nguyen",
"given_names": "T.",
"email": "[email protected]",
"affiliations": [
{
"value": "Department of Physics, Can Tho University, 3/2 Street, Can Tho, Vietnam",
"organization": "Can Tho University",
"country": "Vietnam"
}
],
"full_name": "Nguyen, T."
},
{
"surname": "Hue",
"given_names": "L.",
"email": "[email protected]",
"affiliations": [
{
"value": "Subatomic Physics Research Group, Science and Technology Advanced Institute, Van Lang University, Ho Chi Minh City, Vietnam",
"organization": "Van Lang University",
"country": "Vietnam"
}
],
"full_name": "Hue, L."
},
{
"orcid": "0009-0005-5993-6895",
"surname": "Nha",
"given_names": "N.",
"email": "[email protected]",
"affiliations": [
{
"value": "Subatomic Physics Research Group, Science and Technology Advanced Institute, Van Lang University, Ho Chi Minh City, Vietnam",
"organization": "Van Lang University",
"country": "Vietnam"
},
{
"value": "Faculty of Applied Technology, School of Technology, Van Lang University, Ho Chi Minh City, Vietnam",
"organization": "Van Lang University",
"country": "Vietnam"
}
],
"full_name": "Nha, N."
}
]
assert expected_output == article_with_orcid["authors"]
Loading

0 comments on commit 3e1f0c3

Please sign in to comment.