summaryrefslogtreecommitdiff
path: root/tests/test_ext_math.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ext_math.py')
-rw-r--r--tests/test_ext_math.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py
index 256236489..b5de6cc1c 100644
--- a/tests/test_ext_math.py
+++ b/tests/test_ext_math.py
@@ -39,7 +39,7 @@ def test_imgmath_png(app, status, warning):
if "dvipng command 'dvipng' cannot be run" in warning.getvalue():
raise pytest.skip.Exception('dvipng command "dvipng" is not available')
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
html = (r'<div class="math">\s*<p>\s*<img src="_images/math/\w+.png"'
r'\s*alt="a\^2\+b\^2=c\^2"/>\s*</p>\s*</div>')
assert re.search(html, content, re.S)
@@ -57,7 +57,7 @@ def test_imgmath_svg(app, status, warning):
if "dvisvgm command 'dvisvgm' cannot be run" in warning.getvalue():
raise pytest.skip.Exception('dvisvgm command "dvisvgm" is not available')
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
html = (r'<div class="math">\s*<p>\s*<img src="_images/math/\w+.svg"'
r'\s*alt="a\^2\+b\^2=c\^2"/>\s*</p>\s*</div>')
assert re.search(html, content, re.S)
@@ -69,7 +69,7 @@ def test_imgmath_svg(app, status, warning):
def test_mathjax_options(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
assert ('<script async="async" integrity="sha384-0123456789" '
'src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?'
'config=TeX-AMS-MML_HTMLorMML"></script>' in content)
@@ -80,7 +80,7 @@ def test_mathjax_options(app, status, warning):
def test_mathjax_align(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
html = (r'<div class="math notranslate nohighlight">\s*'
r'\\\[ \\begin\{align\}\\begin\{aligned\}S \&amp;= \\pi r\^2\\\\'
r'V \&amp;= \\frac\{4\}\{3\} \\pi r\^3\\end\{aligned\}\\end\{align\} \\\]</div>')
@@ -93,7 +93,7 @@ def test_mathjax_align(app, status, warning):
def test_math_number_all_mathjax(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
html = (r'<div class="math notranslate nohighlight" id="equation-index-0">\s*'
r'<span class="eqno">\(1\)<a .*>\xb6</a></span>\\\[a\^2\+b\^2=c\^2\\\]</div>')
assert re.search(html, content, re.S)
@@ -104,7 +104,7 @@ def test_math_number_all_mathjax(app, status, warning):
def test_math_number_all_latex(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'python.tex').text()
+ content = (app.outdir / 'python.tex').read_text()
macro = (r'\\begin{equation\*}\s*'
r'\\begin{split}a\^2\+b\^2=c\^2\\end{split}\s*'
r'\\end{equation\*}')
@@ -134,7 +134,7 @@ def test_math_number_all_latex(app, status, warning):
def test_math_eqref_format_html(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'math.html').text()
+ content = (app.outdir / 'math.html').read_text()
html = ('<p>Referencing equation <a class="reference internal" '
'href="#equation-foo">Eq.1</a> and <a class="reference internal" '
'href="#equation-foo">Eq.1</a>.</p>')
@@ -147,7 +147,7 @@ def test_math_eqref_format_html(app, status, warning):
def test_math_eqref_format_latex(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'python.tex').text()
+ content = (app.outdir / 'python.tex').read_text()
macro = (r'Referencing equation Eq.\\ref{equation:math:foo} and '
r'Eq.\\ref{equation:math:foo}.')
assert re.search(macro, content, re.S)
@@ -160,7 +160,7 @@ def test_math_eqref_format_latex(app, status, warning):
def test_mathjax_numfig_html(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'math.html').text()
+ content = (app.outdir / 'math.html').read_text()
html = ('<div class="math notranslate nohighlight" id="equation-math-0">\n'
'<span class="eqno">(1.2)')
assert html in content
@@ -178,7 +178,7 @@ def test_mathjax_numfig_html(app, status, warning):
def test_imgmath_numfig_html(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'page.html').text()
+ content = (app.outdir / 'page.html').read_text()
html = '<span class="eqno">(3)<a class="headerlink" href="#equation-bar"'
assert html in content
html = ('<p>Referencing equations <a class="reference internal" '
@@ -218,7 +218,7 @@ def test_math_compat(app, status, warning):
def test_mathjax_config(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
assert ('<script type="text/x-mathjax-config">'
'MathJax.Hub.Config({"extensions": ["tex2jax.js"]})'
'</script>' in content)
@@ -229,5 +229,5 @@ def test_mathjax_config(app, status, warning):
def test_mathjax_is_not_installed_if_no_equations(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
assert 'MathJax.js' not in content