Skip to content
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

fix possible truncation of strings with "expandable" output fields #6533

Merged
merged 3 commits into from
Dec 21, 2024

Conversation

grondo
Copy link
Contributor

@grondo grondo commented Dec 21, 2024

This PR fixes truncation of strings in output formats that use the +: sentinel, when the field width is greater than the minimum precision (e.g. +:{field:10.10} and the maximum width > 10)

Problem: A test in t/python/t0024-util.py doesn't specify the 'f'
format type so OutputFormat will adjust width and precision as a
string, which the test does not expect.

Fix the test to use the 'f' presentation type.
Problem: The `+:` sentinel which expands width of fields doesn't adjust
precision as well, which ends up truncating strings in a field that
has been expanded to fit the largest value.

The set of matching types needs to be expanded from ("s", None)
to include the empty string to handle the case where a presentation
type is not specified, so string is assumed.

Add "" to the set of types for which to adjust precision.

Fixes flux-framework#6530
Problem: No test in the testsuite ensures that the OutputFormat
class adjusts precision for string presentation types if the width
is adjusted due to the `+:` sentinel.

Add a test that ensures correct handling of precision.
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@grondo
Copy link
Contributor Author

grondo commented Dec 21, 2024

Thanks!

@mergify mergify bot merged commit d58f245 into flux-framework:master Dec 21, 2024
35 checks passed
Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.63%. Comparing base (bb3e8c7) to head (27f4c50).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6533   +/-   ##
=======================================
  Coverage   83.63%   83.63%           
=======================================
  Files         522      522           
  Lines       87860    87860           
=======================================
+ Hits        73479    73482    +3     
+ Misses      14381    14378    -3     
Files with missing lines Coverage Δ
src/bindings/python/flux/util.py 96.55% <ø> (+0.41%) ⬆️

... and 7 files with indirect coverage changes

@grondo grondo deleted the issue#6530 branch December 21, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants