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

Function test_usetex_packages

lib/matplotlib/tests/test_usetex.py:105–120  ·  view source on GitHub ↗
(pkg)

Source from the content-addressed store, hash-verified

103
104@pytest.mark.parametrize('pkg', ['xcolor', 'chemformula'])
105def test_usetex_packages(pkg):
106 if not _has_tex_package(pkg):
107 pytest.skip(f'{pkg} is not available')
108 mpl.rcParams['text.usetex'] = True
109
110 fig = plt.figure()
111 text = fig.text(0.5, 0.5, "Some text 0123456789")
112 fig.canvas.draw()
113
114 mpl.rcParams['text.latex.preamble'] = (
115 r'\PassOptionsToPackage{dvipsnames}{xcolor}\usepackage{%s}' % pkg)
116 fig = plt.figure()
117 text2 = fig.text(0.5, 0.5, "Some text 0123456789")
118 fig.canvas.draw()
119 np.testing.assert_array_equal(text2.get_window_extent(),
120 text.get_window_extent())
121
122
123@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

_has_tex_packageFunction · 0.90
figureMethod · 0.80
textMethod · 0.45
drawMethod · 0.45
get_window_extentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…