Skip to content

Commit 2afd553

Browse files
committed
Add test unknown unit get_gridcell_area
1 parent b4b6a9e commit 2afd553

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

climada/util/test/test_coordinates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,15 @@ def test_get_gridcellarea(self):
659659
self.assertAlmostEqual(area2[0], 1781.5973363005)
660660
self.assertTrue(area2[0] <= 2500)
661661

662+
with self.assertRaises(ValueError) as cm:
663+
area_unknown_unit = u_coord.get_gridcellarea(
664+
lat, resolution, unit="unknown"
665+
)
666+
self.assertIn(
667+
f"'unknown' unit not recognized. Please use any of 'm2', 'km2' or 'ha'.",
668+
str(cm.exception),
669+
)
670+
662671
def test_read_vector_pass(self):
663672
"""Test one columns data"""
664673
shp_file = shapereader.natural_earth(

0 commit comments

Comments
 (0)