Skip to content

Commit

Permalink
disallow bad args at Quantity construction
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpearsonuk committed Aug 7, 2023
1 parent c570847 commit 3229be9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,15 @@ def test_error_messages():


def test_instantiate_quantity_with_unrecognized_units_causes_exception():
with pytest.raises(Exception):
with pytest.raises(q.QuantityError):
q.Quantity(
value=10, units="piggies"
)
with pytest.raises(q.QuantityError):
q.Quantity(
value=10, units="piggies s^-1"
)
with pytest.raises(q.QuantityError):
q.Quantity(
value=10, units="piggies^2 m^-3"
)

0 comments on commit 3229be9

Please sign in to comment.