Skip to content

Commit 1a46563

Browse files
committed
TST: add test for matplotlibrc and rcsetup to be in sync
1 parent e2a21aa commit 1a46563

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_rcparams.py

+18
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from matplotlib import _api, _c_internal_utils
1414
import matplotlib.pyplot as plt
1515
import matplotlib.colors as mcolors
16+
import matplotlib.rcsetup as rcsetup
1617
import numpy as np
1718
from matplotlib.rcsetup import (
1819
validate_bool,
@@ -31,6 +32,23 @@
3132
_listify_validator)
3233

3334

35+
def test_rc_validators_in_sync():
36+
# make sure that matplotlibrc.template and rcsetup._validators
37+
# are in sync.
38+
rc = mpl._rc_params_in_file(
39+
'matplotlibrc.template',
40+
# Strip leading comment.
41+
transform=lambda line: line[1:] if line.startswith("#") else line,
42+
fail_on_error=True)
43+
for key, validator in rcsetup._validators.items():
44+
if (key not in mpl._deprecated_remain_as_none and
45+
key not in mpl._deprecated_ignore_map and
46+
key[0] != '_'):
47+
assert key in list(rc.keys())
48+
for key in list(rc.keys()):
49+
assert key in list(rcsetup._validators.keys())
50+
51+
3452
def test_rcparams(tmpdir):
3553
mpl.rc('text', usetex=False)
3654
mpl.rc('lines', linewidth=22)

0 commit comments

Comments
 (0)