8000 TST: add test for warning · matplotlib/matplotlib@03b3d28 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03b3d28

Browse files
committed
TST: add test for warning
1 parent 8e51231 commit 03b3d28

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,3 +947,16 @@ def test_change_epoch():
947947
np.testing.assert_allclose(
948948
mdates.date2num(np.datetime64('1970-01-01T12:00:00')),
949949
0.5)
950+
951+
952+
def test_warn_notintervals():
953+
dates = np.arange('2001-01-10', '2001-03-04', dtype='datetime64[D]')
954+
locator = mdates.AutoDateLocator(interval_multiples=False)
955+
locator.intervald[3] = [2]
956+
locator.create_dummy_axis()
957+
locator.set_view_interval(mdates.date2num(dates[0]),
958+
mdates.date2num(dates[-1]))
959+
with pytest.warns(UserWarning) as rec:
960+
locs = locator()
961+
assert len(rec) == 1
962+
assert "AutoDateLocator was unable" in str(rec[0].message)

0 commit comments

Comments
 (0)
0