Skip to content

Commit 9528daf

Browse files
Update docstring in naturaldelta (#242)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 87666f2 commit 9528daf

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/humanize/time.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,18 @@ def naturaldelta(
117117
Examples:
118118
Compare two timestamps in a custom local timezone::
119119
120-
import datetime as dt
121-
from dateutil.tz import gettz
120+
```pycon
121+
>>> import datetime as dt
122+
>>> from dateutil.tz import gettz
122123
123-
berlin = gettz("Europe/Berlin")
124-
now = dt.datetime.now(tz=berlin)
125-
later = now + dt.timedelta(minutes=30)
124+
>>> berlin = gettz("Europe/Berlin")
125+
>>> now = dt.datetime.now(tz=berlin)
126+
>>> later = now + dt.timedelta(minutes=30)
127+
128+
>>> assert naturaldelta(later - now) == "30 minutes"
129+
True
130+
```
126131
127-
assert naturaldelta(later - now) == "30 minutes"
128132
"""
129133
import datetime as dt
130134

0 commit comments

Comments
 (0)