Repository navigation
Changed fstring to make error clearer #21968
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d9518d7
Changed fstring to make error clearer
23b8f4d
Merge branch 'main' of https://github.com/matplotlib/matplotlib into …
a527add
Added test for color value error
eee434e
Update test_axes.py
7beb751
Update test_axes.py
9571213
Update test_axes.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
I have encountered this issue, and thanks for the PR! Would this simple test below work? @sveneschlbeck @tacaswell
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.
@yuanx749 Thanks for the input...
@tacaswell Is that still the same logic? I think this is not exactly the same/equivalent message, right?
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.
Picking the conditions on the test is a bit of an art.
Too specific and you can end up with a really brittle test suite that breaks on tiny changes that no user will ever care about. A test suite that is always broken or you are always having to change with the code is not really doing its job and causing you a whole lot of work!
Too general it will always pass, even if you make changes that significantly break users. This is also not great as again you test suite is not doing its job and still causing you a whole bunch of work.
As written the tests are failing because https://github.com/matplotlib/matplotlib/runs/4566462001?check_suite_focus=true#step:12:142
in the namespace where the fstring is being evaluated we do not have
cdefined. You could change the test so the you dowhich tests that the literal string
'blue\\n'shows up. With @yuanx749 's suggestion you do not have to change anything else and it checks that at least one of new line, tab, or carriage return is literally in the message.Between these two I would lean slightly towards searching for
'blue\n'(assume the escaping is right), in case we in the future add a note like "be careful you do not have a trailing \t or \n!" into the error message. In that case we would be able to stop putting the repr in and still have the test pass. However, I would be happy to merge this in either case so long as the tests pass now, the new test would fail without your other changes, and you can make a case as to why you wrote the test the way you did if asked.