10000 MAINT moved test_dates to pytest · matplotlib/matplotlib@11b8dcd · GitHub
[go: up one dir, main page]

Skip to content

Commit 11b8dcd

Browse files
committed
MAINT moved test_dates to pytest
1 parent 5881e72 commit 11b8dcd

File tree

2 files changed

+19
-30
lines changed

2 files changed

+19
-30
lines changed

lib/matplotlib/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,6 @@ def _jupyter_nbextension_paths():
14931493
'matplotlib.tests.test_compare_images',
8000
14941494
'matplotlib.tests.test_container',
14951495
'matplotlib.tests.test_contour',
1496-
'matplotlib.tests.test_dates',
14971496
'matplotlib.tests.test_dviread',
14981497
'matplotlib.tests.test_figure',
14991498
'matplotlib.tests.test_font_manager',

lib/matplotlib/tests/test_dates.py

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
import six
54
from six.moves import map
65

76
import datetime
87
import warnings
98
import tempfile
9+
import pytest
1010

1111
import dateutil
1212
import pytz
@@ -16,8 +16,8 @@
1616
from unittest import mock
1717
except ImportError:
1818
import mock
19-
from nose.tools import assert_raises, assert_equal
20-
from nose.plugins.skip import SkipTest
19+
20+
from numpy.testing import assert_raises, assert_equal
2121

2222
from matplotlib.testing.decorators import image_comparison, cleanup
2323
import matplotlib.pyplot as plt
@@ -180,18 +180,16 @@ def test_strftime_fields(dt):
180180
"{hour24:02d} {hour12:02d} {minute:02d} {second:02d} "
181181
"%{microsecond:06d} %x"
182182
.format(
183-
# weeknum=dt.isocalendar()[1], # %U/%W {weeknum:02d}
184-
# %w Sunday=0, weekday() Monday=0
185-
weekday=str((dt.weekday() + 1) % 7),
186-
day=dt.day,
187-
month=dt.month,
188-
year=dt.year % 100,
189-
full_year=dt.year,
190-
hour24=dt.hour,
191-
hour12=((dt.hour-1) % 12) + 1,
192-
minute=dt.minute,
193-
second=dt.second,
194-
microsecond=dt.microsecond))
183+
weekday=str((dt.weekday() + 1) % 7),
184+
day=dt.day,
185+
month=dt.month,
186+
year=dt.year % 100,
187+
full_year=dt.year,
188+
hour24=dt.hour,
189+
hour12=((dt.hour-1) % 12) + 1,
190+
minute=dt.minute,
191+
second=dt.second,
192+
microsecond=dt.microsecond))
195193
assert_equal(formatter.strftime(dt), formatted_date_str)
196194

197195
try:
@@ -446,10 +444,7 @@ def tz_convert(dt_list, tzinfo):
446444
def test_date2num_dst_pandas():
447445
# Test for github issue #3896, but in date2num around DST transitions
448446
# with a timezone-aware pandas date_range object.
449-
try:
450-
import pandas as pd
451-
except ImportError:
452-
raise SkipTest('pandas not installed')
447+
pd = pytest.importorskip('pandas')
453448

454449
def tz_convert(*args):
455450
return pd.DatetimeIndex.tz_convert(*args).astype(datetime.datetime)
@@ -458,18 +453,13 @@ def tz_convert(*args):
458453

459454

460455
def test_DayLocator():
461-
assert_raises(ValueError, mdates.DayLocator, interval=-1)
462-
assert_raises(ValueError, mdates.DayLocator, interval=-1.5)
463-
assert_raises(ValueError, mdates.DayLocator, interval=0)
464-
assert_raises(ValueError, mdates.DayLocator, interval=1.3)
465-
mdates.DayLocator(interval=1.0)
456+
assert_raises(ValueError, mdates.DayLocator, interval=-1)
457+
assert_raises(ValueError, mdates.DayLocator, interval=-1.5)
458+
assert_raises(ValueError, mdates.DayLocator, interval=0)
459+
assert_raises(ValueError, mdates.DayLocator, interval=1.3)
460+
mdates.DayLocator(interval=1.0)
466461

467462

468463
def test_tz_utc():
469464
dt = datetime.datetime(1970, 1, 1, tzinfo=mdates.UTC)
470465
dt.tzname()
471-
472-
473-
if __name__ == '__main__':
474-
import nose
475-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)
0