@@ -85,12 +85,31 @@ def test_date_empty():
85
85
fig , ax = plt .subplots ()
86
86
ax .xaxis_date ()
87
87
fig .draw_no_output ()
88
- np .testing .assert_allclose (ax .get_xlim (),
88
+ np .testing .assert_allclose (ax .get_xlim (),
89
89
[mdates .date2num (np .datetime64 ('2000-01-01' )),
90
90
mdates .date2num (np .datetime64 ('2010-01-01' ))])
91
91
mdates ._reset_epoch_test_example ()
92
92
93
93
94
+ def test_axhline ():
95
+ # make sure that axhline doesn't set the xlimits...
96
+ fig , ax = plt .subplots ()
97
+ ax .axhline (1.5 )
98
+ ax .plot ([np .datetime64 ('2016-01-01' ), np .datetime64 ('2016-01-02' )], [1 , 2 ])
99
+ np .testing .assert_allclose (ax .get_xlim (),
100
+ [mdates .date2num (np .datetime64 ('2016-01-01' )),
101
+ mdates .date2num (np .datetime64 ('2016-01-02' ))])
102
+
103
+ mdates ._reset_epoch_test_example ()
104
+ mdates .set_epoch ('0000-12-31' )
105
+ fig , ax = plt .subplots ()
106
+ ax .axhline (1.5 )
107
+ ax .plot ([np .datetime64 ('2016-01-01' ), np .datetime64 ('2016-01-02' )], [1 , 2 ])
108
+ np .testing .assert_allclose (ax .get_xlim (),
109
+ [mdates .date2num (np .datetime64 ('2016-01-01' )),
110
+ mdates .date2num (np .datetime64 ('2016-01-02' ))])
111
+ mdates ._reset_epoch_test_example ()
112
+
94
113
95
114
@image_comparison (['date_axhspan.png' ])
96
115
def test_date_axhspan ():
0 commit comments