Skip to content

Fix naturaldelta doctest - #402

Merged
hugovk merged 1 commit into
python-humanize:mainfrom
hugovk:fix-doctest
Sep 16, 2026
Merged

hugovk merged 1 commit into
python-humanize:mainfrom
hugovk:fix-doctest

Conversation

@hugovk

@hugovk hugovk commented Sep 16, 2026

Copy link
Copy Markdown
Member

Before

pytest --doctest-modules src/humanize/time.py -q
...F.                                                                         [100%]
===================================== FAILURES ======================================
_______________________ [doctest] humanize.time.naturaldelta ________________________
125
126     ```pycon
127     >>> import datetime as dt
128     >>> from dateutil.tz import gettz
129
130     >>> berlin = gettz("Europe/Berlin")
131     >>> now = dt.datetime.now(tz=berlin)
132     >>> later = now + dt.timedelta(minutes=30)
133
134     >>> assert naturaldelta(later - now) == "30 minutes"
Expected:
    True
    ```
Got nothing

/Users/hugo/github/humanize/src/humanize/time.py:134: DocTestFailure
============================== short test summary info ==============================
FAILED src/humanize/time.py::humanize.time.naturaldelta
1 failed, 4 passed in 0.04s

After

pytest --doctest-modules src/humanize/time.py -q
.....                                                                         [100%]

@hugovk hugovk added documentation Improvements or additions to documentation changelog: Fixed For any bug fixes labels Sep 16, 2026
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (ffdf407) to head (3829f92).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #402   +/-   ##
=======================================
  Coverage   99.69%   99.69%           
=======================================
  Files          12       12           
  Lines         983      983           
=======================================
  Hits          980      980           
  Misses          3        3           
Flag Coverage Δ
macos-latest 97.55% <ø> (ø)
ubuntu-latest 97.55% <ø> (ø)
windows-latest 93.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hugovk
hugovk merged commit f971127 into python-humanize:main Sep 16, 2026
46 checks passed
@hugovk
hugovk deleted the fix-doctest branch September 16, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant