10000 Merge pull request #15965 from dstansby/cmap-reg-test · matplotlib/matplotlib@d5400cb · GitHub
[go: up one dir, main page]

Skip to content

Commit d5400cb

Browse files
authored
Merge pull request #15965 from dstansby/cmap-reg-test
Test registering cmaps
2 parents 621f298 + 414345b commit d5400cb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ def test_resample():
4848
assert_array_almost_equal(lc3([0, 0.5, 1]), expected)
4949

5050

51+
def test_register_cmap():
52+
new_cm = copy.copy(plt.cm.viridis)
53+
cm.register_cmap('viridis2', new_cm)
54+
assert plt.get_cmap('viridis2') == new_cm
55+
56+
with pytest.raises(ValueError,
57+
match='Arguments must include a name or a Colormap'):
58+
cm.register_cmap()
59+
60+
5161
def test_colormap_copy():
5262
cm = plt.cm.Reds
5363
cm_copy = copy.copy(cm)

0 commit comments

Comments
 (0)
0