-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metric
: Fix precision format
#159
Conversation
Please can you share a snippet of code that reproduces the problem, and also include tests? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
=======================================
Coverage 99.19% 99.19%
=======================================
Files 9 9
Lines 746 746
=======================================
Hits 740 740
Misses 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I added a couple of tests. A snippet that shows the problem would be something like this: import humanize
print(humanize.metric(10, "", 0))
# expected: 10
# actual: ValueError: Format specifier missing precision |
Thank you! |
I ran into the same problem (and found the same fix). It would be great to release a new version to PyPI that includes this fix. |
Thanks for the ping, we're long overdue a release, I'll make one this week. |
4.10.0 is released! |
Great! |
Currently if I try to print a 2 digit number with precision 0, I get this error:
ValueError: Format specifier missing precision
because the format results in a negative precision number.This PR makes sure that the precision is at least 0