Closed
Description
The following failure has shown up a couple times in CI today. Haven't looked in detail but assume it to be an unreliable test.
=================================== FAILURES ===================================
_____________________________ TestTSPlot.test_time _____________________________
[gw0] linux -- Python 3.6.6 /home/vsts/miniconda3/envs/pandas-dev/bin/python
self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x7f2889f69978>
@pytest.mark.slow
def test_time(self):
t = datetime(1, 1, 1, 3, 30, 0)
deltas = np.random.randint(1, 20, 3).cumsum()
ts = np.array([(t + timedelta(minutes=int(x))).time() for x in deltas])
df = DataFrame({'a': np.random.randn(len(ts)),
'b': np.random.randn(len(ts))},
index=ts)
fig, ax = self.plt.subplots()
df.plot(ax=ax)
# verify tick labels
fig.canvas.draw()
ticks = ax.get_xticks()
labels = ax.get_xticklabels()
for t, l in zip(ticks, labels):
m, s = divmod(int(t), 60)
h, m = divmod(m, 60)
rs = l.get_text()
if len(rs) > 0:
if s != 0:
xp = time(h, m, s).strftime('%H:%M:%S')
else:
xp = time(h, m, s).strftime('%H:%M')
assert xp == rs
# change xlim
ax.set_xlim('1:30', '5:00')
# check tick labels again
fig.canvas.draw()
ticks = ax.get_xticks()
labels = ax.get_xticklabels()
for t, l in zip(ticks, labels):
m, s = divmod(int(t), 60)
h, m = divmod(m, 60)
rs = l.get_text()
if len(rs) > 0:
if s != 0:
xp = time(h, m, s).strftime('%H:%M:%S')
else:
xp = time(h, m, s).strftime('%H:%M')
> assert xp == rs
E AssertionError: assert '01:06:40' == '03:40'
E - 01:06:40
E + 03:40