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 vounit formatting of fractions and powers #15282
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The code and tests look good! What is still needed is a changelog fragment.
astropy/units/tests/test_format.py
Outdated
@pytest.mark.parametrize( | ||
"fraction", | ||
[True, "inline"], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should fit on a single line. Is the trailing comma intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure were it came from, as black had nothing to change here. And IMO trailing commas in this case are normal black format for multi-line parameter lists.
6633b68
to
daabd14
Compare
@mhvk Changelog entry is added. |
daabd14
to
1f59982
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good now!
…282-on-v5.3.x Backport PR #15282 on branch v5.3.x (Fix vounit formatting of fractions and powers)
Description
Issue #15074 (comment) shows that there are two bugs in the vounit formatte that produce output not compliant to the VOUnits standard. If fractions are used, the formatter adds a space around the slash, and for fractional power exponents the power sign (
**
) is omitted:This PR addresses both, and adds unit tests for them.