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

Skip to content

Commit 6be45af

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 119fcbd commit 6be45af

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

+29
-51
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 2 additions & 0 deletions

lib/matplotlib/_mathtext_data.py

Lines changed: 0 additions & 24 deletions
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

Lines changed: 1 addition & 7 deletions
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

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,19 @@
120120
"\\phi \\chi \\psi")
121121
all = [digits, uppercase, lowercase, uppergreek, lowergreek]
122122

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

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

160169

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

165174

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

183189

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

0 commit comments

Comments
 (0)