summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgeorg.brandl <devnull@localhost>2008-08-10 16:59:27 +0000
committergeorg.brandl <devnull@localhost>2008-08-10 16:59:27 +0000
commit3a0e87adccff168d448147e9c9be9ac4a46d8c7e (patch)
treeccc9b448a89d099d067e4f2db67bf0bdc592479d /tests
parentf04b6fccc55d7d9e860978949419085a8b1896de (diff)
downloadsphinx-3a0e87adccff168d448147e9c9be9ac4a46d8c7e.tar.gz
Merged revisions 65566-65567,65623,65625 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x ........ r65566 | georg.brandl | 2008-08-07 09:11:11 +0000 (Thu, 07 Aug 2008) | 2 lines Clarification for the ref role. ........ r65567 | georg.brandl | 2008-08-07 09:11:25 +0000 (Thu, 07 Aug 2008) | 2 lines Rebuild everything if extensions change. ........ r65623 | georg.brandl | 2008-08-10 11:18:42 +0000 (Sun, 10 Aug 2008) | 2 lines Unify handling of LaTeX escaping, and add some more replacements. ........ r65625 | georg.brandl | 2008-08-10 11:25:41 +0000 (Sun, 10 Aug 2008) | 2 lines Make tex escapes a module. ........
Diffstat (limited to 'tests')
-rw-r--r--tests/test_markup.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/test_markup.py b/tests/test_markup.py
index 3a3cb9d7..e718e081 100644
--- a/tests/test_markup.py
+++ b/tests/test_markup.py
@@ -63,10 +63,14 @@ def verify_re(rst, html_expected, latex_expected):
latex_translator.first_document = -1 # don't write \begin{document}
document.walkabout(latex_translator)
latex_translated = ''.join(latex_translator.body).strip()
- assert re.match(latex_expected, latex_translated), 'from ' + rst
+ assert re.match(latex_expected, latex_translated), 'from ' + repr(rst)
def verify(rst, html_expected, latex_expected):
- verify_re(rst, re.escape(html_expected) + '$', re.escape(latex_expected) + '$')
+ if html_expected:
+ html_expected = re.escape(html_expected) + '$'
+ if latex_expected:
+ latex_expected = re.escape(latex_expected) + '$'
+ verify_re(rst, html_expected, latex_expected)
def test_inline():
@@ -85,7 +89,7 @@ def test_inline():
# interpolation of arrows in menuselection
verify(':menuselection:`a --> b`',
u'<p><em>a \N{TRIANGULAR BULLET} b</em></p>',
- '\\emph{a $\\rightarrow$ b}')
+ '\\emph{a \\(\\rightarrow\\) b}')
# non-interpolation of dashes in option role
verify_re(':option:`--with-option`',
@@ -99,3 +103,12 @@ def test_inline():
'<p><tt class="docutils literal"><span class="pre">'
'&quot;John&quot;</span></tt></p>',
'\\code{"John"}')
+
+def test_latex_escaping():
+ # correct escaping in normal mode
+ verify(u'Γ\\\\∞$', None, ur'\(\Gamma\)\textbackslash{}\(\infty\)\$')
+ # in verbatim code fragments
+ verify(u'::\n\n @Γ\\∞$[]', None,
+ u'\\begin{Verbatim}[commandchars=@\\[\\]]\n'
+ u'@at[]@(@Gamma@)\\@(@infty@)@$@lb[]@rb[]\n'
+ u'\\end{Verbatim}')