Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb0786b

Browse files
committed
Add test that legend doesn't warn with TeX enabled.
1 parent 5037eef commit bb0786b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_legend.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,22 @@ def test_alpha_handles():
637637
assert lh.get_edgecolor()[:-1] == hh[1].get_edgecolor()[:-1]
638638

639639

640+
@pytest.mark.skipif(
641+
not mpl.checkdep_usetex(True),
642+
reason="This test needs a TeX installation")
643+
def test_usetex_no_warn(caplog):
644+
mpl.rcParams['font.family'] = 'serif'
645+
mpl.rcParams['font.serif'] = 'Computer Modern'
646+
mpl.rcParams['text.usetex'] = True
647+
648+
fig, ax = plt.subplots()
649+
ax.plot(0, 0, label='input')
650+
ax.legend(title="My legend")
651+
652+
fig.canvas.draw()
653+
assert "Font family ['serif'] not found." not in caplog.text
654+
655+
640656
def test_warn_big_data_best_loc():
641657
fig, ax = plt.subplots()
642658
fig.canvas.draw() # So that we can call draw_artist later.

0 commit comments

Comments
 (0)