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 971d110

Browse filesBrowse files
authored
Merge pull request #21005 from anntzer/rdmt
Test the rcParams deprecation machinery.
2 parents 87bae58 + f7622b6 commit 971d110
Copy full SHA for 971d110

File tree

1 file changed

+36
-0
lines changed
Filter options

1 file changed

+36
-0
lines changed

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,39 @@ def test_backend_fallback_headful(tmpdir):
508508
# The actual backend will depend on what's installed, but at least tkagg is
509509
# present.
510510
assert backend.strip().lower() != "agg"
511+
512+
513+
def test_deprecation(monkeypatch):
514+
monkeypatch.setitem(
515+
mpl._deprecated_map, "patch.linewidth",
516+
("0.0", "axes.linewidth", lambda old: 2 * old, lambda new: new / 2))
517+
with pytest.warns(_api.MatplotlibDeprecationWarning):
518+
assert mpl.rcParams["patch.linewidth"] \
519+
== mpl.rcParams["axes.linewidth"] / 2
520+
with pytest.warns(_api.MatplotlibDeprecationWarning):
521+
mpl.rcParams["patch.linewidth"] = 1
522+
assert mpl.rcParams["axes.linewidth"] == 2
523+
524+
monkeypatch.setitem(
525+
mpl._deprecated_ignore_map, "patch.edgecolor",
526+
("0.0", "axes.edgecolor"))
527+
with pytest.warns(_api.MatplotlibDeprecationWarning):
528+
assert mpl.rcParams["patch.edgecolor"] \
529+
== mpl.rcParams["axes.edgecolor"]
530+
with pytest.warns(_api.MatplotlibDeprecationWarning):
531+
mpl.rcParams["patch.edgecolor"] = "#abcd"
532+
assert mpl.rcParams["axes.edgecolor"] != "#abcd"
533+
534+
monkeypatch.setitem(
535+
mpl._deprecated_ignore_map, "patch.force_edgecolor",
536+
("0.0", None))
537+
with pytest.warns(_api.MatplotlibDeprecationWarning):
538+
assert mpl.rcParams["patch.force_edgecolor"] is None
539+
540+
monkeypatch.setitem(
541+
mpl._deprecated_remain_as_none, "svg.hashsalt",
542+
("0.0",))
543+
with pytest.warns(_api.MatplotlibDeprecationWarning):
544+
mpl.rcParams["svg.hashsalt"] = "foobar"
545+
assert mpl.rcParams["svg.hashsalt"] == "foobar" # Doesn't warn.
546+
mpl.rcParams["svg.hashsalt"] = None # Doesn't warn.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.