8000 Fix mathtext mismatched braces · matplotlib/matplotlib@69d796a · GitHub
[go: up one dir, main page]

Skip to content

Commit 69d796a

Browse files
committed
Fix mathtext mismatched braces
1 parent 0a6beed commit 69d796a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,8 @@ def main(self, s, loc, toks):
20302030
return [Hlist(toks)]
20312031

20322032
def math_string(self, s, loc, toks):
2033-
return self._math_expression.parseString(toks[0][1:-1])
2033+
return self._math_expression.parseString(toks[0][1:-1],
2034+
parseAll=True)
20342035

20352036
def math(self, s, loc, toks):
20362037
hlist = Hlist(toks)

lib/matplotlib/tests/test_mathtext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def test_fontinfo():
320320
(r'$a^2^2$', r'Double superscript'),
321321
(r'$a_2_2$', r'Double subscript'),
322322
(r'$a^2_a^2$', r'Double superscript'),
323+
(r'$a = {b$', r'Expected end of text'),
323324
],
324325
ids=[
325326
'hspace without value',
@@ -347,7 +348,8 @@ def test_fontinfo():
347348
'unknown symbol',
348349
'double superscript',
349350
'double subscript',
350-
'super on sub without braces'
351+
'super on sub without braces',
352+
'math string with no closing braces'
351353
]
352354
)
353355
def test_mathtext_exceptions(math, msg):

0 commit comments

Comments
 (0)
0