Skip to content

Commit f53301d

Browse files
committed
Test that cmr10 in Mathtext does not warn about missing \times.
1 parent ba8980c commit f53301d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from contextlib import nullcontext
22
import itertools
33
import locale
4+
import logging
45
import re
56

67
import numpy as np
@@ -725,6 +726,24 @@ def test_mathtext_ticks(self):
725726
ax.set_xticks([-1, 0, 1])
726727
fig.canvas.draw()
727728

729+
def test_cmr10_substitutions(self, caplog):
730+
mpl.rcParams.update({
731+
'font.family': 'cmr10',
732+
'mathtext.fontset': 'cm',
733+
'axes.formatter.use_mathtext': True,
734+
})
735+
736+
# Test that it does not log a warning about missing glyphs.
737+
with caplog.at_level(logging.WARNING, logger='matplotlib.mathtext'):
738+
fig, ax = plt.subplots()
739+
ax.plot([-0.03, 0.05], [40, 0.05])
740+
ax.set_yscale('log')
741+
yticks = [0.02, 0.3, 4, 50]
742+
formatter = mticker.LogFormatterSciNotation()
743+
ax.set_yticks(yticks, map(formatter, yticks))
744+
fig.canvas.draw()
745+
assert not caplog.text
746+
728747
def test_empty_locs(self):
729748
sf = mticker.ScalarFormatter()
730749
sf.set_locs([])

0 commit comments

Comments
 (0)