Skip to content

Commit

Permalink
added tests from invalid cardinal bounds inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGebhart committed Dec 13, 2024
1 parent 7526ab3 commit 679c2ec
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions climada/util/test/test_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2316,8 +2316,6 @@ def test_get_country_bounding_box(self):
48.08521494500006,
] # Italy's bounding box

np.testing.assert_array_almost_equal(result, expected, decimal=4)

def test_bounds_from_cardinal_bounds(self):
"""Test for conversion from cardinal bounds to bounds."""
np.testing.assert_array_almost_equal(
Expand Down Expand Up @@ -2351,6 +2349,18 @@ def test_bounds_from_cardinal_bounds(self):
(175, -20, 530, 90),
)

# some invalid cases
with self.assertRaises(TypeError):
u_coord.bounds_from_cardinal_bounds(southern=-20, eastern=30, western=20)
with self.assertRaises(TypeError):
u_coord.bounds_from_cardinal_bounds([90, -20, 30, 20])
with self.assertRaises(TypeError):
u_coord.bounds_from_cardinal_bounds(90, -20, 30, 20)
with self.assertRaises(TypeError):
u_coord.bounds_from_cardinal_bounds(
northern="90", southern=-20, eastern=30, western=20
)

def test_invalid_input_string(self):
"""Test for invalid string input."""
with self.assertRaises(Exception):
Expand Down

0 comments on commit 679c2ec

Please sign in to comment.