-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use consistent float-to-str formatting for tests with units #10052
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
Conversation
Looks like this does fix nightly. |
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 looks good to me. Though a pretty obscure corner of the code base...
@@ -36,12 +36,12 @@ def __call__( self, x, pos = None ): | |||
if len(self.locs) == 0: | |||
return '' | |||
else: | |||
return str(x) | |||
return '{:.12g}'.format(x) |
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.
Using ".12" instead of ".12g" would keep the ".0" in the test images, and perhaps avoid the need to change some of them?
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.
You might be right, but let's see how the nightly build feels about it.
Looks like we're good for Fedora 28 and a nightly build. |
Backport PR #10052 on branch v2.1.x
PR Summary
Adding explicit formatting should ensure that the resulting image is always the same. At the very least, this seems to affect Python 2 on Fedora Rawhide (which is a bit odd, TBH, since Py2 is tested on Travis) and hopefully fixes nightly builds too.
PR Checklist