feat!: generalize script by removing organizational metadata
All checks were successful
Test pipeline / test (push) Successful in 14s
All checks were successful
Test pipeline / test (push) Successful in 14s
Remove Phase class, organizational metadata blocks, and unused project fields. Update configuration to use 'default_grants' and simplify PI usage to fallback corresponding author determination only. BREAKING CHANGES: - Remove 'phase' and 'project' fields from configuration - Use 'default_grants' instead of 'default_grant' - Generate only standard Dataverse citation metadata
This commit is contained in:
parent
01bc537bd8
commit
67b46d5140
11 changed files with 207 additions and 269 deletions
|
@ -1,5 +1,5 @@
|
|||
import pytest
|
||||
from doi2dataset import Person, Institution
|
||||
from doi2dataset import Institution, Person
|
||||
|
||||
|
||||
def test_person_to_dict_with_string_affiliation():
|
||||
"""Test Person.to_dict() with a string affiliation."""
|
||||
|
@ -8,35 +8,32 @@ def test_person_to_dict_with_string_affiliation():
|
|||
given_name="John",
|
||||
orcid="0000-0001-2345-6789",
|
||||
email="john.doe@example.org",
|
||||
affiliation="Test University",
|
||||
project=["Project A"]
|
||||
affiliation="Test University"
|
||||
)
|
||||
|
||||
|
||||
result = person.to_dict()
|
||||
|
||||
|
||||
assert result["family_name"] == "Doe"
|
||||
assert result["given_name"] == "John"
|
||||
assert result["orcid"] == "0000-0001-2345-6789"
|
||||
assert result["email"] == "john.doe@example.org"
|
||||
assert result["project"] == ["Project A"]
|
||||
assert result["affiliation"] == "Test University"
|
||||
|
||||
|
||||
def test_person_to_dict_with_institution_ror():
|
||||
"""Test Person.to_dict() with an Institution that has a ROR ID."""
|
||||
inst = Institution("Test University", "https://ror.org/12345")
|
||||
|
||||
|
||||
person = Person(
|
||||
family_name="Doe",
|
||||
given_name="John",
|
||||
orcid="0000-0001-2345-6789",
|
||||
email="john.doe@example.org",
|
||||
affiliation=inst,
|
||||
project=["Project A"]
|
||||
affiliation=inst
|
||||
)
|
||||
|
||||
|
||||
result = person.to_dict()
|
||||
|
||||
|
||||
assert result["affiliation"] == "https://ror.org/12345"
|
||||
# Check other fields too
|
||||
assert result["family_name"] == "Doe"
|
||||
|
@ -46,16 +43,16 @@ def test_person_to_dict_with_institution_ror():
|
|||
def test_person_to_dict_with_institution_display_name_only():
|
||||
"""Test Person.to_dict() with an Institution that has only a display_name."""
|
||||
inst = Institution("Test University") # No ROR ID
|
||||
|
||||
|
||||
person = Person(
|
||||
family_name="Smith",
|
||||
given_name="Jane",
|
||||
orcid="0000-0001-9876-5432",
|
||||
affiliation=inst
|
||||
)
|
||||
|
||||
|
||||
result = person.to_dict()
|
||||
|
||||
|
||||
assert result["affiliation"] == "Test University"
|
||||
assert result["family_name"] == "Smith"
|
||||
assert result["given_name"] == "Jane"
|
||||
|
@ -65,15 +62,15 @@ def test_person_to_dict_with_empty_institution():
|
|||
"""Test Person.to_dict() with an Institution that has neither ROR nor display_name."""
|
||||
# Create an Institution with empty values
|
||||
inst = Institution("")
|
||||
|
||||
|
||||
person = Person(
|
||||
family_name="Brown",
|
||||
given_name="Robert",
|
||||
affiliation=inst
|
||||
)
|
||||
|
||||
|
||||
result = person.to_dict()
|
||||
|
||||
|
||||
assert result["affiliation"] == ""
|
||||
assert result["family_name"] == "Brown"
|
||||
assert result["given_name"] == "Robert"
|
||||
|
@ -86,10 +83,10 @@ def test_person_to_dict_with_no_affiliation():
|
|||
given_name="Alice",
|
||||
orcid="0000-0002-1111-2222"
|
||||
)
|
||||
|
||||
|
||||
result = person.to_dict()
|
||||
|
||||
|
||||
assert result["affiliation"] == ""
|
||||
assert result["family_name"] == "Green"
|
||||
assert result["given_name"] == "Alice"
|
||||
assert result["orcid"] == "0000-0002-1111-2222"
|
||||
assert result["orcid"] == "0000-0002-1111-2222"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue