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

BF: use correct variable in exception upon unknown how to handle value of "species" #1482

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dandi/metadata/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def extract_species(metadata: dict) -> models.SpeciesType | None:
break
if value_id is None:
raise ValueError(
f"Cannot interpret species field: {value}. Please "
f"Cannot interpret species field: {value_orig}. Please "
"contact [email protected] to add your species. "
"You can also put the entire url from NCBITaxon "
"(http://www.ontobee.org/ontology/NCBITaxon) into "
Expand Down
6 changes: 6 additions & 0 deletions dandi/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,12 @@ def test_species():
}


def test_extract_unknown_species():
with pytest.raises(ValueError) as excinfo:
extract_species({"species": "mumba-jumba"})
assert str(excinfo.value).startswith("Cannot interpret")
yarikoptic marked this conversation as resolved.
Show resolved Hide resolved


def test_species_map():
# all alternative names should be lower case
for common_names, *_ in species_map:
Expand Down
Loading