From 90b37eb3772539840daeecbbc285d2a08ed2bfb3 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 26 Aug 2020 13:34:16 +0200 Subject: [PATCH] BUG/TST: fix failing tests with dev versions of pandas and matplotlib (#1588) * BUG/TST: fix failing tests with dev versions of pandas and matplotlib * fixup --- geopandas/array.py | 2 +- geopandas/tests/test_plotting.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geopandas/array.py b/geopandas/array.py index 2b3f2ea..306fc7d 100644 --- a/geopandas/array.py +++ b/geopandas/array.py @@ -1035,7 +1035,7 @@ class GeometryArray(ExtensionArray): ovalues = [param] * len(self) return ovalues - if isinstance(other, (pd.Series, pd.Index)): + if isinstance(other, (pd.Series, pd.Index, pd.DataFrame)): # rely on pandas to unbox and dispatch to us return NotImplemented diff --git a/geopandas/tests/test_plotting.py b/geopandas/tests/test_plotting.py index 096bc3d..2308638 100644 --- a/geopandas/tests/test_plotting.py +++ b/geopandas/tests/test_plotting.py @@ -188,7 +188,7 @@ class TestPointPlotting: # the colorbar matches the Point colors ax = self.df.plot(column="values", cmap="RdYlGn", legend=True) point_colors = ax.collections[0].get_facecolors() - cbar_colors = ax.get_figure().axes[1].collections[0].get_facecolors() + cbar_colors = ax.get_figure().axes[1].collections[-1].get_facecolors() # first point == bottom of colorbar np.testing.assert_array_equal(point_colors[0], cbar_colors[0]) # last point == top of colorbar @@ -198,7 +198,7 @@ class TestPointPlotting: # the colorbar matches the Point colors ax = self.df.plot(column="values", categorical=True, legend=True) point_colors = ax.collections[0].get_facecolors() - cbar_colors = ax.get_legend().axes.collections[0].get_facecolors() + cbar_colors = ax.get_legend().axes.collections[-1].get_facecolors() # first point == bottom of colorbar np.testing.assert_array_equal(point_colors[0], cbar_colors[0]) # last point == top of colorbar @@ -211,7 +211,7 @@ class TestPointPlotting: ) ax = self.df[1:].plot(column="exp", cmap="RdYlGn", legend=True, norm=norm) point_colors = ax.collections[0].get_facecolors() - cbar_colors = ax.get_figure().axes[1].collections[0].get_facecolors() + cbar_colors = ax.get_figure().axes[1].collections[-1].get_facecolors() # first point == bottom of colorbar np.testing.assert_array_equal(point_colors[0], cbar_colors[0]) # last point == top of colorbar