mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Optimize tests: test_jsmath
This commit is contained in:
parent
3fb439c476
commit
b95f450452
31
tests/roots/test-ext-math/math.rst
Normal file
31
tests/roots/test-ext-math/math.rst
Normal 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`.
|
@ -989,21 +989,6 @@ def test_enumerable_node(app, status, warning):
|
|||||||
yield check_xpath, etree, fname, xpath, check, be_found
|
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 < 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 < b</div>' in content
|
|
||||||
|
|
||||||
|
|
||||||
@with_app(buildername='html', testroot='html_extra_path')
|
@with_app(buildername='html', testroot='html_extra_path')
|
||||||
def test_html_extra_path(app, status, warning):
|
def test_html_extra_path(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
@ -14,6 +14,22 @@ import re
|
|||||||
from util import with_app, SkipTest
|
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 < 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 < b</div>' in content
|
||||||
|
|
||||||
|
|
||||||
@with_app('html', testroot='ext-math-simple',
|
@with_app('html', testroot='ext-math-simple',
|
||||||
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
|
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
|
||||||
def test_imgmath_png(app, status, warning):
|
def test_imgmath_png(app, status, warning):
|
||||||
|
Loading…
Reference in New Issue
Block a user