Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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 Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

There are already tests for floats, see tests/humanize_tests/tests.py.

comment:2 by Mads Jensen, 7 years ago

Has patch: set

comment:3 by Tim Graham, 7 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.

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In 398a859:

Fixed #27652 -- Doc'd that intcomma works with floats.

comment:5 by Tim Graham <timograham@…>, 7 years ago

In 4a6dc71:

[1.10.x] Fixed #27652 -- Doc'd that intcomma works with floats.

Backport of 398a859642636a2de0ab920befa320cd9954b49a from master

Note: See TracTickets for help on using tickets.
Back to Top