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
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
|
|
from doi2dataset import NameProcessor, sanitize_filename, validate_email_address
|
|
|
|
|
|
def test_sanitize_filename():
|
|
"""Test the sanitize_filename function to convert DOI to a valid filename."""
|
|
doi = "10.1234/abc.def"
|
|
expected = "10_1234_abc_def"
|
|
result = sanitize_filename(doi)
|
|
assert result == expected
|
|
|
|
def test_split_name_with_comma():
|
|
"""Test splitting a full name that contains a comma."""
|
|
full_name = "Doe, John"
|
|
given, family = NameProcessor.split_name(full_name)
|
|
assert given == "John"
|
|
assert family == "Doe"
|
|
|
|
def test_split_name_without_comma():
|
|
"""Test splitting a full name that does not contain a comma."""
|
|
full_name = "John Doe"
|
|
given, family = NameProcessor.split_name(full_name)
|
|
assert given == "John"
|
|
assert family == "Doe"
|
|
|
|
def test_validate_email_address_valid():
|
|
"""Test that a valid email address is correctly recognized."""
|
|
valid_email = "john.doe@iana.org"
|
|
assert validate_email_address(valid_email) is True
|
|
|
|
def test_validate_email_address_invalid():
|
|
"""Test that an invalid email address is correctly rejected."""
|
|
invalid_email = "john.doe@invalid_domain"
|
|
assert validate_email_address(invalid_email) is False
|