Skip to content

Commit 70ae36f

Browse files
committed
TST: don't actually render 1k+ date ticks
It is enough to ask the locator what ticks it would have (without trying to render them all)
1 parent 338e1e9 commit 70ae36f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,15 @@ def test_too_many_date_ticks(caplog):
152152
'Attempting to set identical left == right' in str(rec[0].message)
153153
ax.plot([], [])
154154
ax.xaxis.set_major_locator(mdates.DayLocator())
155-
fig.canvas.draw()
155+
v = ax.xaxis.get_major_locator()()
156+
assert len(v) > 1000
156157
# The warning is emitted multiple times because the major locator is also
157158
# called both when placing the minor ticks (for overstriking detection) and
158159
# during tick label positioning.
159160
assert caplog.records and all(
160161
record.name == "matplotlib.ticker" and record.levelname == "WARNING"
161162
for record in caplog.records)
162-
163+
assert len(caplog.records) > 0
163164

164165
@image_comparison(['RRuleLocator_bounds.png'])
165166
def test_RRuleLocator():

0 commit comments

Comments
 (0)