Skip to content

Commit ffbc9bd

Browse files
committed
Catch warnings from deprecated colourmaps.
1 parent 97e170d commit ffbc9bd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
import six
55
import itertools
6-
import pytest
6+
import warnings
77
from distutils.version import LooseVersion as V
88

99
import numpy as np
10+
import pytest
1011

1112
from numpy.testing import assert_equal
1213
from numpy.testing.utils import assert_array_equal, assert_array_almost_equal
@@ -612,7 +613,10 @@ def test_colormap_reversing():
612613
"""Check the generated _lut data of a colormap and corresponding
613614
reversed colormap if they are almost the same."""
614615
for name in cm.cmap_d:
615-
cmap = plt.get_cmap(name)
616+
with warnings.catch_warnings(record=True) as w:
617+
warnings.simplefilter('always')
618+
cmap = plt.get_cmap(name)
619+
assert len(w) == (1 if name in ('spectral', 'spectral_r') else 0)
616620
cmap_r = cmap.reversed()
617621
if not cmap_r._isinit:
618622
cmap._init()

0 commit comments

Comments
 (0)