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

Skip to content

Commit 7a8aa99

Browse files
committed
Add test to trigger warning
1 parent d11022e commit 7a8aa99

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,18 @@ def test_cursor_dummy_axis(self, data, expected):
577577
fmt = sf.format_data_short
578578
assert fmt(data) == expected
579579

580+
def test_mathtext_ticks(self):
581+
mpl.rcParams.update({
582+
'font.family': 'serif',
583+
'font.serif': 'cmr10',
584+
'axes.formatter.use_mathtext': False
585+
})
586+
587+
with pytest.warns(UserWarning, match='cmr10 font should ideally'):
588+
fig, ax = plt.subplots()
589+
ax.set_xticks([-1, 0, 1])
590+
fig.canvas.draw()
591+
580592

581593
class FakeAxis:
582594
"""Allow Formatter to be called without having a "full" plot set up."""

0 commit comments

Comments
 (0)