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

Function test_non_default_dpi

lib/matplotlib/tests/test_text.py:388–400  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

386
387@pytest.mark.parametrize('text', ['', 'O'], ids=['empty', 'non-empty'])
388def test_non_default_dpi(text):
389 fig, ax = plt.subplots()
390
391 t1 = ax.text(0.5, 0.5, text, ha='left', va='bottom')
392 fig.canvas.draw()
393 dpi = fig.dpi
394
395 bbox1 = t1.get_window_extent()
396 bbox2 = t1.get_window_extent(dpi=dpi * 10)
397 np.testing.assert_allclose(bbox2.get_points(), bbox1.get_points() * 10,
398 rtol=5e-2)
399 # Text.get_window_extent should not permanently change dpi.
400 assert fig.dpi == dpi
401
402
403def test_get_rotation_string():

Callers

nothing calls this directly

Calls 5

subplotsMethod · 0.45
textMethod · 0.45
drawMethod · 0.45
get_window_extentMethod · 0.45
get_pointsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…