Repository: jmoiron/humanize

Issue:
precisedelta with minimum unit seconds fails when seconds is a very small value
### What did you do?

Calculated a small delta. 
```python
import humanize
from datetime import timedelta
duration_seconds = 1e-06       # A small value, or 0
delta = timedelta(seconds=duration_seconds)
output = humanize.precisedelta(delta, minimum_unit="minutes")
print(output)
```

### What did you expect to happen?

Output would be 0 seconds. 

Alternatively, a better error message or a warning in the documentation would be helpful. 

### What actually happened?

```
>       tail = texts[-1]
E       IndexError: list index out of range
```

### What versions are you using?

* OS: ubuntu
* Python: 3.6.12
* Humanize: 2.6.0




Discussion:

Patch:
diff --git a/src/humanize/time.py b/src/humanize/time.py
index 319d7e4..e40c482 100644
--- a/src/humanize/time.py
+++ b/src/humanize/time.py
@@ -426,6 +426,20 @@ def precisedelta(value, minimum_unit="seconds", suppress=(), format="%0.2f"):
     >>> precisedelta(delta, suppress=['seconds', 'milliseconds', 'microseconds'])
     '1.50 minutes'
 
+    ```
+
+    If the delta is too small to be represented with the minimum unit,
+    a value of zero will be returned:
+
+    ```pycon
+    >>> delta = dt.timedelta(seconds=1)
+    >>> precisedelta(delta, minimum_unit="minutes")
+    '0.02 minutes'
+
+    >>> delta = dt.timedelta(seconds=0.1)
+    >>> precisedelta(delta, minimum_unit="minutes")
+    '0 minutes'
+
     ```
     """
     date, delta = date_and_delta(value)
@@ -501,7 +515,7 @@ def precisedelta(value, minimum_unit="seconds", suppress=(), format="%0.2f"):
     texts = []
     for unit, fmt in zip(reversed(Unit), fmts):
         singular_txt, plural_txt, value = fmt
-        if value > 0:
+        if value > 0 or (not texts and unit == min_unit):
             fmt_txt = ngettext(singular_txt, plural_txt, value)
             if unit == min_unit and math.modf(value)[0] > 0:
                 fmt_txt = fmt_txt.replace("%d", format)


Test patch:
diff --git a/tests/test_time.py b/tests/test_time.py
index 90c0130..f0311ce 100644
--- a/tests/test_time.py
+++ b/tests/test_time.py
@@ -496,6 +496,11 @@ def test_precisedelta_one_unit_enough(val, min_unit, expected):
             "microseconds",
             "1 year, 5 days and 2 seconds",
         ),
+        (
+            dt.timedelta(seconds=0.01),
+            "minutes",
+            "0 minutes",
+        ),
     ],
 )
 def test_precisedelta_multiple_units(val, min_unit, expected):