Skip to content

Commit 2c6ba5b

Browse files
phoflnoatamir
authored andcommitted
WARN: Catch warning in tests (pandas-dev#48753)
* WARN: Catch warning in tests * Move import
1 parent a25a68e commit 2c6ba5b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/tests/plotting/frame/test_frame_color.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,18 @@ def test_if_scatterplot_colorbars_are_next_to_parent_axes(self):
199199
@pytest.mark.parametrize("kw", ["c", "color"])
200200
def test_scatter_with_c_column_name_with_colors(self, cmap, kw):
201201
# https://github.com/pandas-dev/pandas/issues/34316
202+
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0
203+
202204
df = DataFrame(
203205
[[5.1, 3.5], [4.9, 3.0], [7.0, 3.2], [6.4, 3.2], [5.9, 3.0]],
204206
columns=["length", "width"],
205207
)
206208
df["species"] = ["r", "r", "g", "g", "b"]
207-
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"})
209+
if mpl_ge_3_6_0() and cmap is not None:
210+
with tm.assert_produces_warning(UserWarning, check_stacklevel=False):
211+
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"})
212+
else:
213+
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"})
208214
assert ax.collections[0].colorbar is None
209215

210216
def test_scatter_colors(self):

0 commit comments

Comments
 (0)