From 872c1c576dc4bc1724e1c526ddc45cb420394ce3 Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Sun, 23 Jun 2024 21:48:59 -0700 Subject: [PATCH] Add test for #9155 (#9161) * Add test for #9155 I can't get this to fail locally, so adding a test to assess what's going on. Alos excludes matplotlib from type exclusions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- pyproject.toml | 1 - xarray/tests/test_plot.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1815fa6dd5d..2ada0c1c171 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,6 @@ module = [ "h5netcdf.*", "h5py.*", "iris.*", - "matplotlib.*", "mpl_toolkits.*", "nc_time_axis.*", "netCDF4.*", diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py index a44b621a981..b302ad3af93 100644 --- a/xarray/tests/test_plot.py +++ b/xarray/tests/test_plot.py @@ -3406,3 +3406,13 @@ def test_plot1d_filtered_nulls() -> None: actual = pc.get_offsets().shape[0] assert expected == actual + + +@requires_matplotlib +def test_9155() -> None: + # A test for types from issue #9155 + + with figure_context(): + data = xr.DataArray([1, 2, 3], dims=["x"]) + fig, ax = plt.subplots(ncols=1, nrows=1) + data.plot(ax=ax)