@@ -197,6 +197,18 @@ def test_RRuleLocator_dayrange():
197197 # On success, no overflow error shall be thrown
198198
199199
200+ def test_RRuleLocator_close_minmax ():
201+ # if d1 and d2 are very close together, rrule cannot create
202+ # reasonable tick intervals; ensure that this is handled properly
203+ rrule = mdates .rrulewrapper (dateutil .rrule .SECONDLY , interval = 5 )
204+ loc = mdates .RRuleLocator (rrule )
205+ d1 = datetime .datetime (year = 2020 , month = 1 , day = 1 )
206+ d2 = datetime .datetime (year = 2020 , month = 1 , day = 1 , microsecond = 1 )
207+ expected = ['2020-01-01 00:00:00+00:00' ,
208+ '2020-01-01 00:00:00.000001+00:00' ]
209+ assert list (map (str , mdates .num2date (loc .tick_values (d1 , d2 )))) == expected
210+
211+
200212@image_comparison (['DateFormatter_fractionalSeconds.png' ])
201213def test_DateFormatter ():
202214 import matplotlib .testing .jpl_units as units
@@ -991,6 +1003,10 @@ def _create_year_locator(date1, date2, **kwargs):
9911003 '2140-05-16 00:00:00+00:00' , '2160-05-16 00:00:00+00:00' ,
9921004 '2180-05-16 00:00:00+00:00' , '2200-05-16 00:00:00+00:00' ]
9931005 ],
1006+ [datetime .timedelta (weeks = 52 * 5 ),
1007+ {'base' : 20 , 'month' : 9 , 'day' : 25 },
1008+ ['1980-09-25 00:00:00+00:00' , '2000-09-25 00:00:00+00:00' ]
1009+ ],
9941010 )
9951011
9961012 for delta , arguments , expected in results :
0 commit comments