| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Previously, `naturaldelta` calculated years using integer division (floor), which caused durations close to the next year (e.g., 2.9 years) to be reported incorrectly (e.g., as "2 years"). This commit changes the logic to round the number of years to the nearest integer, consistent with how other units (minutes, hours) are handled and matching the function's docstring. - Update `src/humanize/time.py` to round years. - Add regression test in `tests/test_time.py` for ~2.9 years.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #295 +/- ##
==========================================
+ Coverage 99.51% 99.56% +0.04%
==========================================
Files 11 12 +1
Lines 831 914 +83
==========================================
+ Hits 827 910 +83
Misses 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.