Skip to content

Commit

Permalink
Add test for case where physical type is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Feb 2, 2024
1 parent f055a95 commit 3cb6419
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stellarphot/settings/tests/test_astropy_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ def test_with_physical_type():
)


def test_bad_physical_type_raises_error():
with pytest.raises(ValueError, match="'not_a_type' is not a known physical type"):

class Model(BaseModel):
not_a_type: Annotated[QuantityType, WithPhysicalType("not_a_type")]


def test_quantity_type_with_invalid_quantity():
with pytest.raises(ValidationError, match="It does not start with a number"):
_QuantityModel(quantity="meter")
Expand Down

0 comments on commit 3cb6419

Please sign in to comment.