con / duct

A helper to run a command, capture stdout/stderr and details about running
https://pypi.org/project/con-duct/
MIT License
3 stars 2 forks source link

Round before formatting #181

Closed asmacdo closed 2 months ago

asmacdo commented 2 months ago

If we don't do the rounding prior to formatting, the summary_format (being a format string, not an f-string) is not smart enough to handle floats OR None (or str 'unknown'). So instead we need to handle that first.

Fixes: https://github.com/con/duct/issues/172 Fixes: https://github.com/con/duct/issues/171

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.03%. Comparing base (2b12679) to head (b79229a). Report is 26 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #181 +/- ## ========================================== + Coverage 94.92% 95.03% +0.10% ========================================== Files 2 2 Lines 473 483 +10 Branches 73 75 +2 ========================================== + Hits 449 459 +10 Misses 12 12 Partials 12 12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yarikoptic commented 2 months ago

Frankly I don't like this as it spreads aspects of formatting now from format specification into the code. as for "unknown" I already gave a nice solution to again allow it to be float or None (not sure some ad-hoc string) and then being nicely formatted: then you keep value nicely pythonic Optional[float] and format it the way you like it. that is my 1c. and I gave already a dollar of those I think so far.

asmacdo commented 2 months ago

Closing in favor of https://github.com/con/duct/pull/183