Skip to content

Commit a64eec1

Browse files
committed
test_datetimelike::test_time*: make testing tick labels actually work
1 parent f5d17cc commit a64eec1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/tests/plotting/test_datetimelike.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,10 +1033,11 @@ def test_time(self):
10331033
df = DataFrame({'a': np.random.randn(len(ts)),
10341034
'b': np.random.randn(len(ts))},
10351035
index=ts)
1036-
_, ax = self.plt.subplots()
1036+
fig, ax = self.plt.subplots()
10371037
df.plot(ax=ax)
10381038

10391039
# verify tick labels
1040+
fig.canvas.draw()
10401041
ticks = ax.get_xticks()
10411042
labels = ax.get_xticklabels()
10421043
for t, l in zip(ticks, labels):
@@ -1051,6 +1052,7 @@ def test_time(self):
10511052
ax.set_xlim('1:30', '5:00')
10521053

10531054
# check tick labels again
1055+
fig.canvas.draw()
10541056
ticks = ax.get_xticks()
10551057
labels = ax.get_xticklabels()
10561058
for t, l in zip(ticks, labels):
@@ -1070,10 +1072,11 @@ def test_time_musec(self):
10701072
df = DataFrame({'a': np.random.randn(len(ts)),
10711073
'b': np.random.randn(len(ts))},
10721074
index=ts)
1073-
_, ax = self.plt.subplots()
1075+
fig, ax = self.plt.subplots()
10741076
ax = df.plot(ax=ax)
10751077

10761078
# verify tick labels
1079+
fig.canvas.draw()
10771080
ticks = ax.get_xticks()
10781081
labels = ax.get_xticklabels()
10791082
for t, l in zip(ticks, labels):

0 commit comments

Comments
 (0)