Optimize tests: test_jsmath

This commit is contained in:
Takeshi KOMIYA 2016-07-14 01:20:49 +09:00
parent 3fb439c476
commit b95f450452
3 changed files with 47 additions and 15 deletions

View File

@ -0,0 +1,31 @@
Test math extensions :math:`E = m c^2`
======================================
This is inline math: :math:`a^2 + b^2 = c^2`.
.. math:: a^2 + b^2 = c^2
.. math::
a + 1 < b
.. math::
:label: foo
e^{i\pi} = 1
.. math::
:label:
e^{ix} = \cos x + i\sin x
.. math::
n \in \mathbb N
.. math::
:nowrap:
a + 1 < b
Referencing equation :eq:`foo`.

View File

@ -989,21 +989,6 @@ def test_enumerable_node(app, status, warning):
yield check_xpath, etree, fname, xpath, check, be_found
@with_app(buildername='html')
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 ('<span class="eqno">(1)</span><div class="math" id="equation-foo">\n'
'e^{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(buildername='html', testroot='html_extra_path')
def test_html_extra_path(app, status, warning):
app.builder.build_all()

View File

@ -14,6 +14,22 @@ import re
from util import with_app, SkipTest
@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 ('<span class="eqno">(1)</span><div class="math" id="equation-foo">\n'
'e^{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):