Skip to content

Commit 4389648

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 4389648

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,13 +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)
163+
assert len(caplog.records) > 0
162164

163165

164166
@image_comparison(['RRuleLocator_bounds.png'])

0 commit comments

Comments
 (0)