Skip to content

Commit 422c847

Browse files
committed
Fix assert vs error messages in range validation
1 parent b506340 commit 422c847

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

regions/shapes/range.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ def _validate_inputs_lonlat_bounds_vertices(self):
238238

239239
# Vertices can be Skycoord of specified length or None, depending on bounds:
240240
if self._bound_nverts > 0:
241-
assert (isinstance(self._vertices, SkyCoord)
242-
& (len(self._vertices) == self._bound_nverts))
243-
else:
244-
assert self._vertices is None
241+
if (isinstance(self._vertices, SkyCoord)
242+
& (len(self._vertices) != self._bound_nverts)):
243+
raise ValueError('Invalid vertices direct input! Inconsistent with bounds.')
244+
elif (self._vertices is not None) & (self._bound_nverts == 0):
245+
raise ValueError('Invalid vertices direct input! Inconsistent with bounds.')
245246

246247
# -------------------------------------------------------------------------------
247248
# ALWAYS derive boundaries on the fly, IF all _params are not None

0 commit comments

Comments
 (0)