Skip to content

Commit

Permalink
Simplify invalid chemical symbol error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Sep 23, 2021
1 parent 8ce8a26 commit de90193
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions optimade/models/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
from optimade.server.warnings import MissingExpectedField

EXTENDED_CHEMICAL_SYMBOLS = CHEMICAL_SYMBOLS + EXTRA_SYMBOLS
EXTENDED_CHEMICAL_SYMBOLS = set(CHEMICAL_SYMBOLS + EXTRA_SYMBOLS)


__all__ = (
Expand Down Expand Up @@ -146,7 +146,7 @@ class Species(BaseModel):
@validator("chemical_symbols", each_item=True)
def validate_chemical_symbols(cls, v):
if not (v in EXTENDED_CHEMICAL_SYMBOLS):
raise ValueError(f"{v} MUST be in {EXTENDED_CHEMICAL_SYMBOLS}")
raise ValueError(f"{v} MUST be an element symbol, 'vacancy' or 'X'.")
return v

@validator("concentration", "mass")
Expand Down

0 comments on commit de90193

Please sign in to comment.