summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-07-14 01:20:49 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-07-14 01:43:25 +0900
commitb95f450452976de371fabea6d93859acecb37f38 (patch)
treea41d1f87c81dc6e5c5b358c398a41127f1f801fa
parent3fb439c476fa2013b8c7e3b95066b8e075b52c9b (diff)
downloadsphinx-git-b95f450452976de371fabea6d93859acecb37f38.tar.gz
Optimize tests: test_jsmath
-rw-r--r--tests/roots/test-ext-math/math.rst31
-rw-r--r--tests/test_build_html.py15
-rw-r--r--tests/test_ext_math.py16
3 files changed, 47 insertions, 15 deletions
diff --git a/tests/roots/test-ext-math/math.rst b/tests/roots/test-ext-math/math.rst
new file mode 100644
index 000000000..5a209bed4
--- /dev/null
+++ b/tests/roots/test-ext-math/math.rst
@@ -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`.
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 7abefbcdc..a127b96e0 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -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()
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py
index 517ba30c8..c858afcd2 100644
--- a/tests/test_ext_math.py
+++ b/tests/test_ext_math.py
@@ -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):