Skip to content

Commit

Permalink
Merge pull request #3719 from jenshnielsen/rcparam_warn_error
Browse files Browse the repository at this point in the history
ENH : Turn rcparams warning into error and remove knowfail
  • Loading branch information
tacaswell committed Oct 26, 2014
2 parents bf29166 + 852a831 commit b74145f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
26 changes: 2 additions & 24 deletions lib/matplotlib/__init__.py
Expand Up @@ -834,14 +834,6 @@ def matplotlib_fname():
_all_deprecated = set(chain(_deprecated_ignore_map,
_deprecated_map, _obsolete_set))

_rcparam_warn_str = ("Trying to set {key} to {value} via the {func} "
"method of RcParams which does not validate cleanly. "
"This warning will turn into an Exception in 1.5. "
"If you think {value} should validate correctly for "
"rcParams[{key}] "
"please create an issue on github."
)


class RcParams(dict):

Expand All @@ -861,14 +853,7 @@ class RcParams(dict):
# validate values on the way in
def __init__(self, *args, **kwargs):
for k, v in six.iteritems(dict(*args, **kwargs)):
try:
self[k] = v
except (ValueError, RuntimeError):
# force the issue
warnings.warn(_rcparam_warn_str.format(key=repr(k),
value=repr(v),
func='__init__'))
dict.__setitem__(self, k, v)
self[k] = v

def __setitem__(self, key, val):
try:
Expand Down Expand Up @@ -908,14 +893,7 @@ def __getitem__(self, key):
# through __setitem__
def update(self, *args, **kwargs):
for k, v in six.iteritems(dict(*args, **kwargs)):
try:
self[k] = v
except (ValueError, RuntimeError):
# force the issue
warnings.warn(_rcparam_warn_str.format(key=repr(k),
value=repr(v),
func='update'))
dict.__setitem__(self, k, v)
self[k] = v

def __repr__(self):
import pprint
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/tests/test_rcparams.py
Expand Up @@ -105,8 +105,6 @@ def test_RcParams_class():
assert ['font.family'] == list(six.iterkeys(rc.find_all('family')))


# remove know failure + warnings after merging to master
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
def test_rcparams_update():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
Expand All @@ -123,8 +121,6 @@ def test_rcparams_update():
rc.update(bad_dict)


# remove know failure + warnings after merging to master
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
def test_rcparams_init():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
Expand Down

0 comments on commit b74145f

Please sign in to comment.