add tests for math_numfig

This commit is contained in:
Oliver Jahn 2017-10-05 12:41:22 -04:00
parent 7fc43d3365
commit 783cff44b3
3 changed files with 60 additions and 0 deletions

View File

@ -2,8 +2,10 @@ Test Math
=========
.. toctree::
:numbered: 1
math
page
.. math:: a^2+b^2=c^2

View File

@ -0,0 +1,9 @@
Test multiple pages
===================
.. math::
:label: bar
a = b + 1
Referencing equations :eq:`foo` and :eq:`bar`.

View File

@ -139,3 +139,52 @@ def test_math_eqref_format_latex(app, status, warning):
content = (app.outdir / 'test.tex').text()
macro = r'Referencing equation Eq.\\ref{equation:math:foo}.'
assert re.search(macro, content, re.S)
@pytest.mark.sphinx('html', testroot='ext-math',
confoverrides={'extensions': ['sphinx.ext.mathjax'],
'numfig': True,
'math_numfig': True})
def test_mathjax_numfig_html(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'math.html').text()
html = ('<div class="math" id="equation-math:0">\n'
'<span class="eqno">(1.2)')
assert html in content
html = ('<p>Referencing equation <a class="reference internal" '
'href="#equation-foo">(1.1)</a>.</p>')
assert html in content
@pytest.mark.sphinx('html', testroot='ext-math',
confoverrides={'extensions': ['sphinx.ext.jsmath'],
'jsmath_path': 'dummy.js',
'numfig': True,
'math_numfig': True})
def test_jsmath_numfig_html(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'math.html').text()
html = '<span class="eqno">(1.2)<a class="headerlink" href="#equation-math:0"'
assert html in content
html = ('<p>Referencing equation <a class="reference internal" '
'href="#equation-foo">(1.1)</a>.</p>')
assert html in content
@pytest.mark.sphinx('html', testroot='ext-math',
confoverrides={'extensions': ['sphinx.ext.imgmath'],
'numfig': True,
'numfig_secnum_depth': 0,
'math_numfig': True})
def test_imgmath_numfig_html(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'page.html').text()
html = '<span class="eqno">(3)<a class="headerlink" href="#equation-bar"'
assert html in content
html = ('<p>Referencing equations <a class="reference internal" '
'href="math.html#equation-foo">(1)</a> and '
'<a class="reference internal" href="#equation-bar">(3)</a>.</p>')
assert html in content