8000 Parametrize colormap reversing test. · matplotlib/matplotlib@d700f03 · GitHub
[go: up one dir, main page]

Skip to content

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 d700f03

Browse files
committed
Parametrize colormap reversing test.
This is a bit nicer for debugging.
1 parent c6e5515 commit d700f03

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -608,19 +608,19 @@ def test_pandas_iterable():
608608
assert_array_equal(cm1.colors, cm2.colors)
609609

610610

611-
def test_colormap_reversing():
611+
@pytest.mark.parametrize('name', cm.cmap_d)
612+
def test_colormap_reversing(name):
612613
"""Check the generated _lut data of a colormap and corresponding
613614
reversed colormap if they are almost the same."""
614-
for name in cm.cmap_d:
615-
with warnings.catch_warnings(record=True) as w:
616-
warnings.simplefilter('always')
617-
cmap = plt.get_cmap(name)
618-
assert len(w) == (1 if name in ('spectral', 'spectral_r') else 0)
619-
cmap_r = cmap.reversed()
620-
if not cmap_r._isinit:
621-
cmap._init()
622-
cmap_r._init()
623-
assert_array_almost_equal(cmap._lut[:-3], cmap_r._lut[-4::-1])
615+
with warnings.catch_warnings(record=True) as w:
616+
warnings.simplefilter('always')
617+
cmap = plt.get_cmap(name)
618+
assert len(w) == (1 if name in ('spectral', 'spectral_r') else 0)
619+
cmap_r = cmap.reversed()
620+
if not cmap_r._isinit:
621+
cmap._init()
622+
cmap_r._init()
623+
assert_array_almost_equal(cmap._lut[:-3], cmap_r._lut[-4::-1])
624624

625625

626626
@cleanup

0 commit comments

Comments
 (0)
0