8000 TST: test re-registering builtin colormap · matplotlib/matplotlib@f184145 · GitHub
[go: up one dir, main page]

Skip to content

Commit f184145

Browse files
tacaswellgreglucas
authored andcommitted
TST: test re-registering builtin colormap
The existing test bounced on an earlier code path. This restores missing coverage.
1 parent fb902f7 commit f184145

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ def test_register_cmap():
8686

8787
def test_double_register_builtin_cmap():
8888
name = "viridis"
89+
match = f"Re-registering the builtin cmap {name!r}."
90+
with pytest.raises(ValueError, match=match):
91+
matplotlib.colormaps.register(
92+
cm.get_cmap(name), name=name, force=True
93+
)
8994
with pytest.raises(ValueError, match='A colormap named "viridis"'):
9095
cm.register_cmap(name, cm.get_cmap(name))
9196
with pytest.warns(UserWarning):

0 commit comments

Comments
 (0)
0