@@ -77,17 +77,17 @@ def test_date_empty():
7777 ax .xaxis_date ()
7878 fig .draw_without_rendering ()
7979 np .testing .assert_allclose (ax .get_xlim (),
80- [mdates .date2num (np .datetime64 ('2000 -01-01' )),
81- mdates .date2num (np .datetime64 ('2010 -01-01 ' ))])
80+ [mdates .date2num (np .datetime64 ('1970 -01-01' )),
81+ mdates .date2num (np .datetime64 ('1970 -01-02 ' ))])
8282
8383 mdates ._reset_epoch_test_example ()
8484 mdates .set_epoch ('0000-12-31' )
8585 fig , ax = plt .subplots ()
8686 ax .xaxis_date ()
8787 fig .draw_without_rendering ()
8888 np .testing .assert_allclose (ax .get_xlim (),
89- [mdates .date2num (np .datetime64 ('2000 -01-01' )),
90- mdates .date2num (np .datetime64 ('2010 -01-01 ' ))])
89+ [mdates .date2num (np .datetime64 ('1970 -01-01' )),
90+ mdates .date2num (np .datetime64 ('1970 -01-02 ' ))])
9191 mdates ._reset_epoch_test_example ()
9292
9393
@@ -1235,7 +1235,7 @@ def test_julian2num():
12351235def test_DateLocator ():
12361236 locator = mdates .DateLocator ()
12371237 # Test nonsingular
1238- assert locator .nonsingular (0 , np .inf ) == (10957. 0 , 14610.0 )
1238+ assert locator .nonsingular (0 , np .inf ) == (0 , 1 )
12391239 assert locator .nonsingular (0 , 1 ) == (0 , 1 )
12401240 assert locator .nonsingular (1 , 0 ) == (0 , 1 )
12411241 assert locator .nonsingular (0 , 0 ) == (- 2 , 2 )
@@ -1328,3 +1328,15 @@ def test_usetex_newline():
13281328 fig , ax = plt .subplots ()
13291329 ax .xaxis .set_major_formatter (mdates .DateFormatter ('%d/%m\n %Y' ))
13301330 fig .canvas .draw ()
1331+
1332+
1333+ def test_datetime_masked ():
1334+ # make sure that all-masked data falls back to the viewlim
1335+ # set in convert.axisinfo....
1336+ x = np .array ([datetime .datetime (2017 , 1 , n ) for n in range (1 , 6 )])
1337+ y = np .array ([1 , 2 , 3 , 4 , 5 ])
1338+ m = np .ma .masked_greater (y , 0 )
1339+
1340+ fig , ax = plt .subplots ()
1341+ ax .plot (x , m )
1342+ assert ax .get_xlim () == (0 , 1 )
0 commit comments