Skip to content

Commit bde5999

Browse files
authored
Merge pull request #200 from gliptak/thousand1
2 parents fb2daf3 + 4b13733 commit bde5999

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/humanize/number.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ def intcomma(value, ndigits=None):
119119
return intcomma(new)
120120

121121

122-
powers = [10 ** x for x in (6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 100)]
122+
powers = [10 ** x for x in (3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 100)]
123123
human_powers = (
124+
N_("thousand"),
124125
N_("million"),
125126
N_("billion"),
126127
N_("trillion"),
@@ -146,6 +147,8 @@ def intword(value, format="%.1f"):
146147
```pycon
147148
>>> intword("100")
148149
'100'
150+
>>> intword("12400")
151+
'12.4 thousand'
149152
>>> intword("1000000")
150153
'1.0 million'
151154
>>> intword(1_200_000_000)

tests/test_number.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def test_intword_powers():
7272
"test_args, expected",
7373
[
7474
(["100"], "100"),
75+
(["1000"], "1.0 thousand"),
76+
(["12400"], "12.4 thousand"),
77+
(["12490"], "12.5 thousand"),
7578
(["1000000"], "1.0 million"),
7679
(["1200000"], "1.2 million"),
7780
(["1290000"], "1.3 million"),

0 commit comments

Comments
 (0)