Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd5996a

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

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 17 additions & 0 deletions
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,22 @@
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+
rcFile = mpl._rc_params_in_file('matplotlibrc.template',
39+
# Strip leading comment.
40+
transform=lambda line: line[1:] if line.startswith("#") else line,
41+
fail_on_error=True)
42+
for key, validator in rcsetup._validators.items():
43+
if (key not in mpl._deprecated_remain_as_none and
44+
key not in mpl._deprecated_ignore_map and
45+
key[0]!='_'):
46+
assert key in list(rcFile.keys())
47+
for key in list(rcFile.keys()):
48+
assert key in list(rcsetup._validators.keys())
49+
50+
3451
def test_rcparams(tmpdir):
3552
mpl.rc('text', usetex=False)
3653
mpl.rc('lines', linewidth=22)

0 commit comments

Comments
 (0)