-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
WARN: Catch warning in tests #48753
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
WARN: Catch warning in tests #48753
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
_check_plot_works, | ||
) | ||
|
||
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0 | ||
|
||
|
||
@td.skip_if_no_mpl | ||
class TestDataFrameColor(TestPlotBase): | ||
|
@@ -204,7 +206,11 @@ def test_scatter_with_c_column_name_with_colors(self, cmap, kw): | |
columns=["length", "width"], | ||
) | ||
df["species"] = ["r", "r", "g", "g", "b"] | ||
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"}) | ||
if mpl_ge_3_6_0() and cmap is not None: | ||
with tm.assert_produces_warning(UserWarning, check_stacklevel=False): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this indicate that we are doing something wrong/outdated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MarcoGorelli looks like you raised and addressed this issue in #34344 Do you remember if passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW: I think this is a new warning in mpl 3.6 so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was silently ignored before. They added stricter checks in a few places. If we want to check that the colormap is not applied, then we have to check for the user warning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have some recollection of this issue/PR, I'll take a look tomorrow |
||
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"}) | ||
else: | ||
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"}) | ||
assert ax.collections[0].colorbar is None | ||
|
||
def test_scatter_colors(self): | ||
|
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 think this needs to be imported in the test
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.
thx, moved