Improvements and Bugfixes for value formatting#128
Open
TarEnethil wants to merge 5 commits intomkaz:mainfrom
Open
Improvements and Bugfixes for value formatting#128TarEnethil wants to merge 5 commits intomkaz:mainfrom
TarEnethil wants to merge 5 commits intomkaz:mainfrom
Conversation
* use format_value across all chart types * format_value now takes the full args object instead of individual parameters. * format_value evaluates the args format, percentage, suffix and no_values * cvt_to_readable is no longer responsible for percentage conversion * suffix is no longer appended when no_values is True Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
Support for the --no-readable argument was (accidentally?) removed in 41adfd4 Additional refactoring and consolidation (mkaz#120). With the refactored version of format_value, this is now an easy fix. Only call cvt_to_readable if no_readable is False (as it was before). It now also works for all chart types. Fixes 41adfd4 Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
Since Args self-initializes with a default, I see no reason to do excessive type checking. Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
Add tests that ensure formatting options are working as expected (and so that future refactorings don't break things again). A new helper function run_for_all_charts() is introduced. Histograms are optional, as their value/formatting works a bit differently. Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
When changing test_custom_tick_appears_in_output() to use the new run_for_all_tests() function, I discovered that VerticalChart had no support for custom ticks. After a little refactoring (tick is now a member of Chart and only initialized once), all Charts now support custom ticks. Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR got a bit larger than expected, sorry!
Originally, I kept searching for the reason why
--no-readablewas not working. I tracked this down to #120, where the code was (accidentally) removed. Before fixing the issue itself however, I tried to consistently useformat_valueacross all chart types. After fixing the issue, I wrote some unit tests to ensure the handling of formatting arguments will stay consistent in the future. Through testing I found another bug for custom ticks with VerticalCharts and fixed that up as well.In summary, this PR
format_valueconsistently across all chart types (I cannot guarantee that some existing parameter combinations now lead to a different output than before)--no-readableargument by preventingcvt_to_readable()from being called if the option is setThe changes are in separate commits and described in their respective commit messages, so you can pick and choose which changes you like.
Please let me know what you think!