Skip to content

Commit 37b6350

Browse files
authored
Merge pull request #1482 from dandi/bf-1481
BF: use correct variable in exception upon unknown how to handle value of "species"
2 parents 5faa18a + a303122 commit 37b6350

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

dandi/metadata/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def extract_species(metadata: dict) -> models.SpeciesType | None:
474474
break
475475
if value_id is None:
476476
raise ValueError(
477-
f"Cannot interpret species field: {value}. Please "
477+
f"Cannot interpret species field: {value_orig}. Please "
478478
"contact help@dandiarchive.org to add your species. "
479479
"You can also put the entire url from NCBITaxon "
480480
"(http://www.ontobee.org/ontology/NCBITaxon) into "

dandi/tests/test_metadata.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,12 @@ def test_species():
513513
}
514514

515515

516+
def test_extract_unknown_species():
517+
with pytest.raises(ValueError) as excinfo:
518+
extract_species({"species": "mumba-jumba"})
519+
assert str(excinfo.value).startswith("Cannot interpret species field: mumba-jumba")
520+
521+
516522
def test_species_map():
517523
# all alternative names should be lower case
518524
for common_names, *_ in species_map:

0 commit comments

Comments
 (0)