Skip to content

Commit 75ae4f1

Browse files
committed
test_datetimelike::test_time*: make testing tick labels actually work
1 parent 8157c35 commit 75ae4f1

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
@@ -1032,10 +1032,11 @@ def test_time(self):
10321032
df = DataFrame({'a': np.random.randn(len(ts)),
10331033
'b': np.random.randn(len(ts))},
10341034
index=ts)
1035-
_, ax = self.plt.subplots()
1035+
fig, ax = self.plt.subplots()
10361036
df.plot(ax=ax)
10371037

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

10521053
# check tick labels again
1054+
fig.canvas.draw()
10531055
ticks = ax.get_xticks()
10541056
labels = ax.get_xticklabels()
10551057
for t, l in zip(ticks, labels):
@@ -1069,10 +1071,11 @@ def test_time_musec(self):
10691071
df = DataFrame({'a': np.random.randn(len(ts)),
10701072
'b': np.random.randn(len(ts))},
10711073
index=ts)
1072-
_, ax = self.plt.subplots()
1074+
fig, ax = self.plt.subplots()
10731075
ax = df.plot(ax=ax)
10741076

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

0 commit comments

Comments
 (0)