Commits

Anonymous committed 8f51b87

Added test and implementation to disallow negative minutes.

Comments (0)

Files changed (1)

     Traceback (most recent call last):
     ...
     ValueError: hours must be positive number got -5.00
+    >>> hours2days(3, -14)
+    Traceback (most recent call last):
+    ...
+    ValueError: minutes must be positive number got -14.00
     """
     if not 1 <= base <= 24:
         msg = 'base must be between 1 and 24 got {0:5.2f}'.format(base)
     if hours < 0:
         msg = 'hours must be positive number got {0:5.2f}'.format(hours)
         raise ValueError(msg)
+    if minutes < 0:
+        msg = 'minutes must be positive number got {0:5.2f}'.format(minutes)
+        raise ValueError(msg)
     base = float(base)
     days = (hours + minutes / 60.) / base
     if precision: