Skip to content

Commit

Permalink
Add README examples as tests, and fix 0.333 output
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jun 15, 2020
1 parent c8af6a1 commit ac4d3c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ If seconds are too large, set `minimum_unit` to milliseconds or microseconds:
>>> humanize.fractional(0.3)
'3/10'
>>> humanize.fractional(0.333)
'1/3'
'333/1000'
>>> humanize.fractional(1)
'1'
```
Expand Down
4 changes: 4 additions & 0 deletions tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def test_apnumber(test_input, expected):
("8.9", "8 9/10"),
("ten", "ten"),
(None, None),
(1 / 3, "1/3"),
(1.5, "1 1/2"),
(0.3, "3/10"),
(0.333, "333/1000"),
],
)
def test_fractional(test_input, expected):
Expand Down

0 comments on commit ac4d3c4

Please sign in to comment.