Skip to content

Commit

Permalink
TST: add test for fix of pandas-dev#12405
Browse files Browse the repository at this point in the history
  • Loading branch information
tsdlovell committed Oct 30, 2016
1 parent 5a3ec26 commit d1c8776
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandas.compat import lrange, zip

import numpy as np
from pandas import Index, Series, DataFrame
from pandas import Index, Series, DataFrame, NaT

from pandas.tseries.index import date_range, bdate_range
from pandas.tseries.offsets import DateOffset
Expand Down Expand Up @@ -778,6 +778,28 @@ def test_mixed_freq_irreg_period(self):
irreg.plot()
ps.plot()

def test_nat_handling(self):

import matplotlib.pyplot as plt

def inject_nat_into_index_col(df):
df.loc[len(df)//2, 'index'] = NaT
return df

fig = plt.gcf()
plt.clf()
ax = plt.gca()

s = (tm.makeTimeSeries()
.reset_index()
.pipe(inject_nat_into_index_col)
.set_index('index', drop=True))
s.plot(ax=ax)
xdata = ax.get_lines()[0].get_xdata()
# plot x data is bounded by index values
self.assertLessEqual(s.index.min(), Series(xdata).min())
self.assertLessEqual(Series(xdata).max(), s.index.max())

@slow
def test_to_weekly_resampling(self):
idxh = date_range('1/1/1999', periods=52, freq='W')
Expand Down

0 comments on commit d1c8776

Please sign in to comment.