Skip to content

Commit f2ca9f9

Browse files
committed
Fix alternatives for cmap registration deprecations
1 parent f2663ed commit f2ca9f9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/matplotlib/cm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def unregister(self, name):
204204
@_api.deprecated(
205205
'3.6',
206206
pending=True,
207-
alternative="``matplotlib.colormaps.register_cmap(name)``"
207+
alternative="``matplotlib.colormaps.register(name)``"
208208
)
209209
def register_cmap(name=None, cmap=None, *, override_builtin=False):
210210
"""
@@ -288,7 +288,7 @@ def _get_cmap(name=None, lut=None):
288288
@_api.deprecated(
289289
'3.6',
290290
pending=True,
291-
alternative="``matplotlib.colormaps.unregister_cmap(name)``"
291+
alternative="``matplotlib.colormaps.unregister(name)``"
292292
)
293293
def unregister_cmap(name):
294294
"""

lib/matplotlib/tests/test_colors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_register_cmap():
6969
target = "viridis2"
7070
with pytest.warns(
7171
PendingDeprecationWarning,
72-
match=r"matplotlib\.colormaps\.register_cmap\(name\)"
72+
match=r"matplotlib\.colormaps\.register\(name\)"
7373
):
7474
cm.register_cmap(target, new_cm)
7575
assert mpl.colormaps[target] == new_cm
@@ -78,13 +78,13 @@ def test_register_cmap():
7878
match="Arguments must include a name or a Colormap"):
7979
with pytest.warns(
8080
PendingDeprecationWarning,
81-
match=r"matplotlib\.colormaps\.register_cmap\(name\)"
81+
match=r"matplotlib\.colormaps\.register\(name\)"
8282
):
8383
cm.register_cmap()
8484

8585
with pytest.warns(
8686
PendingDeprecationWarning,
87-
match=r"matplotlib\.colormaps\.unregister_cmap\(name\)"
87+
match=r"matplotlib\.colormaps\.unregister\(name\)"
8888
):
8989
cm.unregister_cmap(target)
9090
with pytest.raises(ValueError,
@@ -96,15 +96,15 @@ def test_register_cmap():
9696
cm.get_cmap(target)
9797
with pytest.warns(
9898
PendingDeprecationWarning,
99-
match=r"matplotlib\.colormaps\.unregister_cmap\(name\)"
99+
match=r"matplotlib\.colormaps\.unregister\(name\)"
100100
):
101101
# test that second time is error free
102102
cm.unregister_cmap(target)
103103

104104
with pytest.raises(TypeError, match="'cmap' must be"):
105105
with pytest.warns(
106106
PendingDeprecationWarning,
107-
match=r"matplotlib\.colormaps\.register_cmap\(name\)"
107+
match=r"matplotlib\.colormaps\.register\(name\)"
108108
):
109109
cm.register_cmap('nome', cmap='not a cmap')
110110

0 commit comments

Comments
 (0)