Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause committed Nov 22, 2024
1 parent 5c021ba commit 2f30ac5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,9 @@ def test_colors_np_levels(self) -> None:
artist = self.darray.plot.contour(levels=levels, colors=["k", "r", "w", "b"])
cmap = artist.cmap
assert isinstance(cmap, mpl.colors.ListedColormap)
colors = cmap.colors
# non-optimal typing in matplotlib (ArrayLike)
# https://github.com/matplotlib/matplotlib/blob/84464dd085210fb57cc2419f0d4c0235391d97e6/lib/matplotlib/colors.pyi#L133
colors = cast(np.ndarray, cmap.colors)

assert self._color_as_tuple(colors[1]) == (1.0, 0.0, 0.0)
assert self._color_as_tuple(colors[2]) == (1.0, 1.0, 1.0)
Expand Down

0 comments on commit 2f30ac5

Please sign in to comment.