8000 add tests for all matplotlib.rc() aliases · r3kste/matplotlib@22a8fcf · GitHub
[go: up one dir, main page]

Skip to content

Commit 22a8fcf

Browse files
committed
add tests for all matplotlib.rc() aliases
1 parent fa3f5f5 commit 22a8fcf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,3 +654,21 @@ def test_rcparams_path_sketch_from_file(tmp_path, value):
654654
rc_path.write_text(f"path.sketch: {value}")
655655
with mpl.rc_context(fname=rc_path):
656656
assert mpl.rcParams["path.sketch"] == (1, 2, 3)
657+
658+
659+
@pytest.mark.parametrize('group, option, alias, value', [
660+
('lines', 'linewidth', 'lw', 3),
661+
('lines', 'linestyle', 'ls', 'dashed'),
662+
('lines', 'color', 'c', 'white'),
663+
('axes', 'facecolor', 'fc', 'black'),
664+
('figure', 'edgecolor', 'ec', 'magenta'),
665+
('lines', 'markeredgewidth', 'mew', 1.5),
666+
('patch', 'antialiased', 'aa', False),
667+
('font', 'sans-serif', 'sans', ["Verdana"])
668+
])
669+
def test_rc_aliases(group, option, alias, value):
670+
rc_kwargs = {alias: value,}
671+
mpl.rc(group, **rc_kwargs)
672+
673+
rcParams_key = f"{group}.{option}"
674+
assert mpl.rcParams[rcParams_key] == value

0 commit comments

Comments
 (0)
0