#27652 closed Cleanup/optimization (fixed)
Humanize docs should clarify: Floats OK too!
Reported by: | Mike Lissner | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description
In the humanize documentation (https://docs.djangoproject.com/en/1.9/ref/contrib/humanize/), it says things like:
intcomma: Converts an integer to a string containing commas every three digits.
intword: Converts a large integer to a friendly text representation.
Etc.
I took a look at the code, and it looks like it's written in such a way that floats would work too without a hitch. Should we update the docs to say as such?
Also: If we do this, do we need tests that include floats?
Change History (5)
comment:1 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 8 years ago
Patch needs improvement: | set |
---|
I forgot to say there are only tests for floats for intcomma
. In my testing, intword
doesn't support floats. '1000000.1' gives the same value back rather than "1 million". This seems fine to me but the PR must be corrected.
There are already tests for floats, see
tests/humanize_tests/tests.py
.