22import numpy as np
33from matplotlib .testing .decorators import image_comparison , knownfailureif
44import matplotlib .pyplot as plt
5+ from nose .tools import assert_raises
56
67@image_comparison (baseline_images = ['date_empty' ])
78def test_date_empty ():
@@ -66,13 +67,12 @@ def test_date_axvline():
6667 fig .autofmt_xdate ()
6768 fig .savefig ('date_axvline' )
6869
69- # we want to test that this method raises a RuntimeError -- what is
70- # the rightway to do this in the current framework
71- @knownfailureif (True )
72- #@image_comparison(baseline_images=['date_xlim_empty'])
73- def test_set_xlim_and_unexpected_handling ():
70+ def test_too_many_date_ticks ():
7471 # Attempt to test SF 2715172, see
7572 # https://sourceforge.net/tracker/?func=detail&aid=2715172&group_id=80706&atid=560720
73+ # setting equal datetimes triggers and expander call in
74+ # transforms.nonsingular which results in too many ticks in the
75+ # DayLocator. This should trigger a Locator.MAXTICKS RuntimeError
7676 t0 = datetime .datetime (2000 , 1 , 20 )
7777 tf = datetime .datetime (2000 , 1 , 20 )
7878 fig = plt .figure ()
@@ -81,13 +81,7 @@ def test_set_xlim_and_unexpected_handling():
8181 ax .plot ([],[])
8282 from matplotlib .dates import DayLocator , DateFormatter , HourLocator
8383 ax .xaxis .set_major_locator (DayLocator ())
84- ax .xaxis .set_major_formatter (DateFormatter ("%m/%d/%y, %I:%M%p" ))
85- ax .xaxis .set_minor_locator (HourLocator ())
86- if 0 :
87- # this seems to cause an ininite loop.
88- from nose .plugins .skip import SkipTest
89- raise SkipTest ('avoiding never-ending drawing' )
90- fig .savefig ('date_xlim_empty' )
84+ assert_raises (RuntimeError , fig .savefig , 'junk.png' )
9185
9286if __name__ == '__main__' :
9387 import nose
0 commit comments