| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Verified locally on the PR branch vs release 4.16.0 (Python 3.13):
The negative-ordinal fix is real and correct — Python's modulo makes the old code produce wrong suffixes:
| input | release | branch |
|---|---|---|
| ordinal(-1) | -1th | -1st |
| ordinal(-2) | -2th | -2nd |
| ordinal(-11) / (-111) | -11th / -111th | same (11/12/13 rule preserved via abs % 100) |
natural_list improvements verified too: plain generators now work (release raises TypeError), oxford_comma=True yields "a, b, and three"-style output while default stays byte-identical, two-item lists ignore the flag correctly.
pytest tests/test_lists.py tests/test_number.py — 243 passed.
One request before merge, on an unrelated bundled hunk: the __version__ fallback hardcodes "4.12.2.dev0" when _version.py is missing. That misreports the actual version in exactly the broken environments where accurate versions matter most (bug reports from source checkouts would claim 4.12.2). Suggest either dropping that hunk from this PR (it's orthogonal to both fixes here) or using a neutral placeholder via importlib.metadata.version("humanize") with a fallback of "unknown".
Everything else: approve-worthy.
Sorry, something went wrong.
|
Thanks for the review @Mukller! I have dropped the _version.py fallback hunk from this PR as suggested. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR resolves two key issues and enhances developer ergonomics:
Negative Integer Ordinal Suffix Calculation (src/humanize/number.py):
Iterable & Oxford Comma Support in natural_list (src/humanize/lists.py):
Source Import & Test Resilience (src/humanize/__init__.py, tests/):
Empirical Test Verification
Ran pytest: