MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_url_tick

Function test_url_tick

lib/matplotlib/tests/test_backend_svg.py:364–388  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

362
363
364def test_url_tick(monkeypatch):
365 monkeypatch.setenv('SOURCE_DATE_EPOCH', '19680801')
366
367 fig1, ax = plt.subplots()
368 ax.scatter([1, 2, 3], [4, 5, 6])
369 for i, tick in enumerate(ax.yaxis.get_major_ticks()):
370 tick.set_url(f'https://example.com/{i}')
371
372 fig2, ax = plt.subplots()
373 ax.scatter([1, 2, 3], [4, 5, 6])
374 for i, tick in enumerate(ax.yaxis.get_major_ticks()):
375 tick.label1.set_url(f'https://example.com/{i}')
376 tick.label2.set_url(f'https://example.com/{i}')
377
378 b1 = BytesIO()
379 fig1.savefig(b1, format='svg')
380 b1 = b1.getvalue()
381
382 b2 = BytesIO()
383 fig2.savefig(b2, format='svg')
384 b2 = b2.getvalue()
385
386 for i in range(len(ax.yaxis.get_major_ticks())):
387 assert f'https://example.com/{i}'.encode('ascii') in b1
388 assert b1 == b2
389
390
391def test_svg_default_metadata(monkeypatch):

Callers

nothing calls this directly

Calls 5

subplotsMethod · 0.45
scatterMethod · 0.45
get_major_ticksMethod · 0.45
set_urlMethod · 0.45
savefigMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…