Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c0c300

Browse files
committed
TST: fix tests
1 parent d7739f3 commit 0c0c300

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Binary file not shown.

lib/matplotlib/tests/test_dates.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ def test_date_empty():
9191
mdates._reset_epoch_test_example()
9292

9393

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+
94113

95114
@image_comparison(['date_axhspan.png'])
96115
def test_date_axhspan():

0 commit comments

Comments
 (0)