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.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py
index 87219c294..af4b873d7 100644
--- a/tests/test_ext_math.py
+++ b/tests/test_ext_math.py
@@ -14,7 +14,24 @@ import re
from util import with_app, SkipTest
-@with_app('html', testroot='ext-math',
+@with_app(buildername='html', testroot='ext-math',
+ confoverrides = {'extensions': ['sphinx.ext.jsmath'], 'jsmath_path': 'dummy.js'})
+def test_jsmath(app, status, warning):
+ app.builder.build_all()
+ content = (app.outdir / 'math.html').text()
+
+ assert '<div class="math">\na^2 + b^2 = c^2</div>' in content
+ assert '<div class="math">\n\\begin{split}a + 1 &lt; b\\end{split}</div>' in content
+ assert (u'<span class="eqno">(1)<a class="headerlink" href="#equation-foo" '
+ u'title="Permalink to this equation">\xb6</a></span>'
+ u'<div class="math" id="equation-foo">\ne^{i\\pi} = 1</div>' in content)
+ assert ('<span class="eqno">(2)</span><div class="math">\n'
+ 'e^{ix} = \\cos x + i\\sin x</div>' in content)
+ assert '<div class="math">\nn \\in \\mathbb N</div>' in content
+ assert '<div class="math">\na + 1 &lt; b</div>' in content
+
+
+@with_app('html', testroot='ext-math-simple',
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
def test_imgmath_png(app, status, warning):
app.builder.build_all()
@@ -28,7 +45,8 @@ def test_imgmath_png(app, status, warning):
'\s*alt="a\^2\+b\^2=c\^2"/>\s*</p>\s*</div>')
assert re.search(html, content, re.S)
-@with_app('html', testroot='ext-math',
+
+@with_app('html', testroot='ext-math-simple',
confoverrides={'extensions': ['sphinx.ext.imgmath'],
'imgmath_image_format': 'svg'})
def test_imgmath_svg(app, status, warning):
@@ -43,6 +61,7 @@ def test_imgmath_svg(app, status, warning):
'\s*alt="a\^2\+b\^2=c\^2"/>\s*</p>\s*</div>')
assert re.search(html, content, re.S)
+
@with_app('html', testroot='ext-math',
confoverrides={'extensions': ['sphinx.ext.mathjax']})
def test_mathjax_align(app, status, warning):
@@ -54,6 +73,7 @@ def test_mathjax_align(app, status, warning):
r'V \&amp;= \\frac\{4\}\{3\} \\pi r\^3\\end\{aligned\}\\end\{align\} \\\]</div>')
assert re.search(html, content, re.S)
+
@with_app('html', testroot='ext-math',
confoverrides={'math_number_all': True,
'extensions': ['sphinx.ext.mathjax']})
@@ -65,6 +85,7 @@ def test_math_number_all_mathjax(app, status, warning):
r'<span class="eqno">\(1\)</span>\\\[a\^2\+b\^2=c\^2\\\]</div>')
assert re.search(html, content, re.S)
+
@with_app('latex', testroot='ext-math',
confoverrides={'extensions': ['sphinx.ext.mathjax']})
def test_math_number_all_latex(app, status, warning):