Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ffbc9bd

Browse filesBrowse files
committed
Catch warnings from deprecated colourmaps.
1 parent 97e170d commit ffbc9bd
Copy full SHA for ffbc9bd

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+6-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.