Skip to content

Commit

Permalink
Test invalid arguments to area constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrost-mo committed Sep 17, 2024
1 parent a1bc3ce commit 638f018
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/operators/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from datetime import datetime

import pytest

from CSET.operators import constraints


Expand Down Expand Up @@ -133,6 +135,17 @@ def test_generate_area_constraint_no_limits():
assert expected_area_constraint in repr(area_constraint)


def test_generate_area_constraint_invalid_arguments():
"""Generate area constraint raises exception with invalid arguments."""
# Non-numbers are rejected.
with pytest.raises(TypeError):
constraints.generate_area_constraint(1, 2, 3, "four")

# Mixed numbers and Nones are rejected.
with pytest.raises(TypeError):
constraints.generate_area_constraint(None, None, None, 0)


def test_combine_constraints():
"""Combine constraint."""
stash_constraint = constraints.generate_stash_constraint("m01s03i236")
Expand Down

0 comments on commit 638f018

Please sign in to comment.