Skip to content

Commit

Permalink
Merge pull request #1482 from dandi/bf-1481
Browse files Browse the repository at this point in the history
BF: use correct variable in exception upon unknown how to handle value of "species"
  • Loading branch information
yarikoptic authored Aug 13, 2024
2 parents 5faa18a + a303122 commit 37b6350
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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 help@dandiarchive.org 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 species field: mumba-jumba")


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

0 comments on commit 37b6350

Please sign in to comment.