Skip to content

Commit 570ef5c

Browse files
committed
Expire deprecation of mathcircled.
Use stubs in font_test_specs to avoid having to re-name all of the later tests.
1 parent 53c8d6a commit 570ef5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+32
-51
lines changed

doc/api/next_api_changes/removals.rst

+5

lib/matplotlib/_mathtext_data.py

-24
Original file line numberDiff line numberDiff line change
@@ -2406,30 +2406,6 @@
24062406
[
24072407
(0x0041, 0x005a, 'it', 0xe22d), # A-Z
24082408
],
2409-
'circled':
2410-
{
2411-
'rm':
2412-
[
2413-
(0x0030, 0x0030, 'rm', 0x24ea), # 0
2414-
(0x0031, 0x0039, 'rm', 0x2460), # 1-9
2415-
(0x0041, 0x005a, 'rm', 0x24b6), # A-Z
2416-
(0x0061, 0x007a, 'rm', 0x24d0) # a-z
2417-
],
2418-
'it':
2419-
[
2420-
(0x0030, 0x0030, 'rm', 0x24ea), # 0
2421-
(0x0031, 0x0039, 'rm', 0x2460), # 1-9
2422-
(0x0041, 0x005a, 'it', 0x24b6), # A-Z
2423-
(0x0061, 0x007a, 'it', 0x24d0) # a-z
2424-
],
2425-
'bf':
2426-
[
2427-
(0x0030, 0x0030, 'bf', 0x24ea), # 0
2428-
(0x0031, 0x0039, 'bf', 0x2460), # 1-9
2429-
(0x0041, 0x005a, 'bf', 0x24b6), # A-Z
2430-
(0x0061, 0x007a, 'bf', 0x24d0) # a-z
2431-
],
2432-
},
24332409
'frak':
24342410
{
24352411
'rm':

lib/matplotlib/mathtext.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -2299,8 +2299,7 @@ class Parser:
22992299

23002300
_dropsub_symbols = set(r'''\int \oint'''.split())
23012301

2302-
_fontnames = set(
2303-
"rm cal it tt sf bf default bb frak circled scr regular".split())
2302+
_fontnames = set("rm cal it tt sf bf default bb frak scr regular".split())
23042303

23052304
_function_names = set("""
23062305
arccos csc ker min arcsin deg lg Pr arctan det lim sec arg dim
@@ -2618,11 +2617,6 @@ def font(self):
26182617

26192618
@font.setter
26202619
def font(self, name):
2621-
if name == "circled":
2622-
cbook.warn_deprecated(
2623-
"3.1", name="\\mathcircled", obj_type="mathtext command",
2624-
alternative="unicode characters (e.g. '\\N{CIRCLED LATIN "
2625-
"CAPITAL LETTER A}' or '\\u24b6')")
26262620
if name in ('rm', 'it', 'bf'):
26272621
self.font_class = name
26282622
self._font = name
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

lib/matplotlib/tests/test_mathtext.py

+26-20
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,19 @@
119119
"\\phi \\chi \\psi")
120120
all = [digits, uppercase, lowercase, uppergreek, lowergreek]
121121

122+
# Use stubs to reserve space if tests are removed
123+
# stub should be of the form (None, N) where is the number of
124+
# strings that used to be tested
125+
# Add new tests at the end.
122126
font_test_specs = [
123127
([], all),
124128
(['mathrm'], all),
125129
(['mathbf'], all),
126130
(['mathit'], all),
127131
(['mathtt'], [digits, uppercase, lowercase]),
128-
(['mathcircled'], [digits, uppercase, lowercase]),
129-
(['mathrm', 'mathcircled'], [digits, uppercase, lowercase]),
130-
(['mathbf', 'mathcircled'], [digits, uppercase, lowercase]),
132+
(None, 3),
133+
(None, 3),
134+
(None, 3),
131135
(['mathbb'], [digits, uppercase, lowercase,
132136
r'\Gamma \Pi \Sigma \gamma \pi']),
133137
(['mathrm', 'mathbb'], [digits, uppercase, lowercase,
@@ -145,27 +149,29 @@
145149

146150
font_tests = []
147151
for fonts, chars in font_test_specs:
148-
wrapper = ''.join([
149-
' '.join(fonts),
150-
' $',
151-
*(r'\%s{' % font for font in fonts),
152-
'%s',
153-
*('}' for font in fonts),
154-
'$',
155-
])
156-
for set in chars:
157-
font_tests.append(wrapper % set)
152+
if fonts is None:
153+
font_tests.extend([None] * chars)
154+
else:
155+
wrapper = ''.join([
156+
' '.join(fonts),
157+
' $',
158+
*(r'\%s{' % font for font in fonts),
159+
'%s',
160+
*('}' for font in fonts),
161+
'$',
162+
])
163+
for set in chars:
164+
font_tests.append(wrapper % set)
165+
166+
font_tests = list(filter(lambda x: x[1] is not None, enumerate(font_tests)))
158167

159168

160169
@pytest.fixture
161170
def baseline_images(request, fontset, index):
162171
return ['%s_%s_%02d' % (request.param, fontset, index)]
163172

164173

165-
# In the following two tests, use recwarn to suppress warnings regarding the
166-
# deprecation of \stackrel and \mathcircled.
167-
168-
174+
# recwarn suppresses warnings regarding the deprecation of \stackrel.
169175
@pytest.mark.parametrize('index, test', enumerate(math_tests),
170176
ids=[str(index) for index in range(len(math_tests))])
171177
@pytest.mark.parametrize('fontset',
@@ -180,14 +186,14 @@ def test_mathtext_rendering(baseline_images, fontset, index, test, recwarn):
180186
horizontalalignment='center', verticalalignment='center')
181187

182188

183-
@pytest.mark.parametrize('index, test', enumerate(font_tests),
184-
ids=[str(index) for index in range(len(font_tests))])
189+
@pytest.mark.parametrize('index, test', font_tests,
190+
ids=[str(index) for index, _ in font_tests])
185191
@pytest.mark.parametrize('fontset',
186192
['cm', 'stix', 'stixsans', 'dejavusans',
187193
'dejavuserif'])
188194
@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)
189195
@image_comparison(baseline_images=None, extensions=['png'])
190-
def test_mathfont_rendering(baseline_images, fontset, index, test, recwarn):
196+
def test_mathfont_rendering(baseline_images, fontset, index, test):
191197
matplotlib.rcParams['mathtext.fontset'] = fontset
192198
fig = plt.figure(figsize=(5.25, 0.75))
193199
fig.text(0.5, 0.5, test,

0 commit comments

Comments
 (0)