[distances] Raise an error on bad units for Geographical distance
authorVincent Michel <vincent.michel@logilab.fr>
Mon, 09 Jun 2014 14:19:26 +0000
changeset 444 43f7648c4397
parent 443 2921c0bfc527
child 449 80c0a2d8624a
[distances] Raise an error on bad units for Geographical distance
utils/distances.py
--- a/utils/distances.py	Wed May 28 09:56:21 2014 +0200
+++ b/utils/distances.py	Mon Jun 09 14:19:26 2014 +0000
@@ -323,7 +323,8 @@
 
         - `units` can be 'm' (meters) or 'km' (kilometers)
     """
-    assert units in ('m', 'km')
+    if units not in ('m', 'km'):
+        raise ValueError("unsupported units, should be in m or km")
     pointa = (float(pointa[0]), float(pointa[1]))
     pointb = (float(pointb[0]), float(pointb[1]))