Skip to content

Commit 679c2ec

Browse files
added tests from invalid cardinal bounds inputs
1 parent 7526ab3 commit 679c2ec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

climada/util/test/test_coordinates.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,8 +2316,6 @@ def test_get_country_bounding_box(self):
23162316
48.08521494500006,
23172317
] # Italy's bounding box
23182318

2319-
np.testing.assert_array_almost_equal(result, expected, decimal=4)
2320-
23212319
def test_bounds_from_cardinal_bounds(self):
23222320
"""Test for conversion from cardinal bounds to bounds."""
23232321
np.testing.assert_array_almost_equal(
@@ -2351,6 +2349,18 @@ def test_bounds_from_cardinal_bounds(self):
23512349
(175, -20, 530, 90),
23522350
)
23532351

2352+
# some invalid cases
2353+
with self.assertRaises(TypeError):
2354+
u_coord.bounds_from_cardinal_bounds(southern=-20, eastern=30, western=20)
2355+
with self.assertRaises(TypeError):
2356+
u_coord.bounds_from_cardinal_bounds([90, -20, 30, 20])
2357+
with self.assertRaises(TypeError):
2358+
u_coord.bounds_from_cardinal_bounds(90, -20, 30, 20)
2359+
with self.assertRaises(TypeError):
2360+
u_coord.bounds_from_cardinal_bounds(
2361+
northern="90", southern=-20, eastern=30, western=20
2362+
)
2363+
23542364
def test_invalid_input_string(self):
23552365
"""Test for invalid string input."""
23562366
with self.assertRaises(Exception):

0 commit comments

Comments
 (0)