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

Skip to content

Commit cee82fb

Browse files
authored
Merge pull request #15002 from anntzer/testdates
No need to access filesystem in test_dates.py.
2 parents 0f54425 + 64d155b commit cee82fb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import datetime
2-
import tempfile
32

43
import dateutil.tz
54
import dateutil.rrule
65
import numpy as np
76
import pytest
87

9-
from matplotlib.testing.decorators import image_comparison
10-
import matplotlib.pyplot as plt
8+
from matplotlib import rc_context
119
from matplotlib.cbook import MatplotlibDeprecationWarning
1210
import matplotlib.dates as mdates
11+
import matplotlib.pyplot as plt
12+
from matplotlib.testing.decorators import image_comparison
1313
import matplotlib.ticker as mticker
14-
from matplotlib import rc_context
1514

1615

1716
def test_date_numpyx():
@@ -299,9 +298,8 @@ def test_empty_date_with_year_formatter():
299298
yearFmt = dates.DateFormatter('%Y')
300299
ax.xaxis.set_major_formatter(yearFmt)
301300

302-
with tempfile.TemporaryFile() as fh:
303-
with pytest.raises(ValueError):
304-
fig.savefig(fh)
301+
with pytest.raises(ValueError):
302+
fig.canvas.draw()
305303

306304

307305
def test_auto_date_locator():

0 commit comments

Comments
 (0)