Skip to content

Commit

Permalink
FIX: remove try, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jklymak committed Jul 9, 2020
1 parent 455fbeb commit a7abf30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,16 @@ def _validate_date_converter(s):
cbook._warn_external(f'date.converter string must be "auto" '
f'or "concise", not "{s}". Check your '
'matplotlibrc')
try:
import matplotlib.dates as mdates
mdates._rcParam_helper.set_converter(s)
except Exception as e:
pass
import matplotlib.dates as mdates
mdates._rcParam_helper.set_converter(s)


def _validate_date_int_mult(s):
if s is None:
return
s = validate_bool(s)
try:
import matplotlib.dates as mdates
mdates._rcParam_helper.set_int_mult(s)
except Exception as e:
pass
import matplotlib.dates as mdates
mdates._rcParam_helper.set_int_mult(s)


def _validate_tex_preamble(s):
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ def test_change_converter():
fig.canvas.draw()
assert ax.get_xticklabels()[0].get_text() == 'Jan 01 2020'
assert ax.get_xticklabels()[1].get_text() == 'Jan 15 2020'
with pytest.warns(UserWarning) as rec:
plt.rcParams['date.converter'] = 'boo'


def test_change_interval_multiples():
Expand Down

0 comments on commit a7abf30

Please sign in to comment.