-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Suppresses failed test case by excepting TypeError from _initialize_x_y #24698
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
Suppresses failed test case by excepting TypeError from _initialize_x_y #24698
Conversation
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
y = y / (self._boundaries[self._inside][-1] - | ||
self._boundaries[self._inside][0]) | ||
|
||
# original |
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.
Please do not keep the original code around. Because the code is in git and there are a number of UIs (inculding this website) for viewing the diffs it is much clearer to simply remove the old code and replace it with the new code. If we kept the full history of Matplotib in-line like this it would very quickly become impossible to read!
cs = ax.contour([[2, 2], [2, 2]]) | ||
assert len(record) == 1 | ||
try: | ||
fig.colorbar(cs, ax=ax) |
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.
Why is this in a try-except?
# self._boundaries[self._inside][0]) | ||
|
||
# change | ||
if (self._boundaries[self._inside][-1] |
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.
does this need an else
branch?
👋🏻 Hi @TianzeMYou - gentle ping that you have a pending review on this PR, are you still interested in working on it? If you need help, please let us know. Cheers! |
The issue has been solved through another fix. |
PR Summary
The original code for reproduction of this issue #23817 is
However, this seems to yield the following TypeError
TypeError: Input z must be 2D, not 1D
The same TypeError also occurs if we change
to
This TypeError is resulted from lib/matplotlib/contour.py, line 1526, in _initialize_x_y, which makes me think that rather than a colorbar problem, the root of this issue lies in how contour works. What is the expected behavior of the original code for reproduction? If we aren't supposed to call Fontour on input like above in the first place, how is Colorbar supposed to behave and why does the the API warning even matter?
I was able to suppress the failed test case with the following change to @quinnah's test case from #24656
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst