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

Skip to content

Rcparam validation fix #3564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 14, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST : known-fail rcparam exceptions tests
Added known-fail to tests that expect rcparam __init__ and
update to raise exceptions on invalid input.
  • Loading branch information
tacaswell committed Oct 10, 2014
commit d8fb74576ffb8b938e3626aa188ca31ee34c5fdc
19 changes: 16 additions & 3 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import matplotlib as mpl
from matplotlib.tests import assert_str_equal
from matplotlib.testing.decorators import cleanup
from matplotlib.testing.decorators import cleanup, knownfailureif
from nose.tools import assert_true, assert_raises, assert_equal
import nose
from itertools import chain
Expand Down Expand Up @@ -104,6 +104,8 @@ 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 @@ -112,15 +114,26 @@ def test_rcparams_update():
bad_dict = {'figure.figsize': (3.5, 42, 1)}
# make sure validation happens on input
with assert_raises(ValueError):
rc.update(bad_dict)

with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message='.*(validate)',
category=UserWarning)
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 "
"not supported with Python < 2.7")
with assert_raises(ValueError):
mpl.RcParams({'figure.figsize': (3.5, 42, 1)})
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message='.*(validate)',
category=UserWarning)
mpl.RcParams({'figure.figsize': (3.5, 42, 1)})


@cleanup
Expand Down