Skip to content

Commit f7823df

Browse files
committed
TST: add test for fix of #12405
1 parent 5a3ec26 commit f7823df

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

pandas/tests/plotting/test_datetimelike.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pandas.compat import lrange, zip
55

66
import numpy as np
7-
from pandas import Index, Series, DataFrame
7+
from pandas import Index, Series, DataFrame, NaT
88

99
from pandas.tseries.index import date_range, bdate_range
1010
from pandas.tseries.offsets import DateOffset
@@ -778,6 +778,23 @@ def test_mixed_freq_irreg_period(self):
778778
irreg.plot()
779779
ps.plot()
780780

781+
def test_nat_handling(self):
782+
783+
import matplotlib.pyplot as plt
784+
785+
fig = plt.gcf()
786+
plt.clf()
787+
ax = plt.gca()
788+
789+
dti = DatetimeIndex(['2015-01-01', NaT, '2015-01-03'])
790+
s = Series(range(len(dti)), dti)
791+
s.plot(ax=ax)
792+
xdata = ax.get_lines()[0].get_xdata()
793+
# plot x data is bounded by index values
794+
self.assertLessEqual(s.index.min(), Series(xdata).min())
795+
self.assertLessEqual(Series(xdata).max(), s.index.max())
796+
_check_plot_works(s.plot)
797+
781798
@slow
782799
def test_to_weekly_resampling(self):
783800
idxh = date_range('1/1/1999', periods=52, freq='W')

0 commit comments

Comments
 (0)