mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Format `tests/
` (#12760)
This commit is contained in:
@@ -30,8 +30,8 @@ def settings(app):
|
||||
# DeprecationWarning: The frontend.OptionParser class will be replaced
|
||||
# by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
|
||||
optparser = frontend.OptionParser(
|
||||
components=(RstParser, HTMLWriter, LaTeXWriter),
|
||||
defaults=default_settings)
|
||||
components=(RstParser, HTMLWriter, LaTeXWriter), defaults=default_settings
|
||||
)
|
||||
settings = optparser.get_default_values()
|
||||
settings.smart_quotes = True
|
||||
settings.env = app.builder.env
|
||||
@@ -71,6 +71,7 @@ def parse(new_document):
|
||||
if msg['level'] == 1:
|
||||
msg.replace_self([])
|
||||
return document
|
||||
|
||||
return parse_
|
||||
|
||||
|
||||
@@ -100,6 +101,7 @@ def verify_re_html(app, parse):
|
||||
document.walkabout(html_translator)
|
||||
html_translated = ''.join(html_translator.fragment).strip()
|
||||
assert re.match(html_expected, html_translated), 'from ' + rst
|
||||
|
||||
return verify
|
||||
|
||||
|
||||
@@ -115,6 +117,7 @@ def verify_re_latex(app, parse):
|
||||
document.walkabout(latex_translator)
|
||||
latex_translated = ''.join(latex_translator.body).strip()
|
||||
assert re.match(latex_expected, latex_translated), 'from ' + repr(rst)
|
||||
|
||||
return verify
|
||||
|
||||
|
||||
@@ -125,6 +128,7 @@ def verify_re(verify_re_html, verify_re_latex):
|
||||
verify_re_html(rst, html_expected)
|
||||
if latex_expected:
|
||||
verify_re_latex(rst, latex_expected)
|
||||
|
||||
return verify_re_
|
||||
|
||||
|
||||
@@ -135,6 +139,7 @@ def verify(verify_re_html, verify_re_latex):
|
||||
verify_re_html(rst, re.escape(html_expected) + '$')
|
||||
if latex_expected:
|
||||
verify_re_latex(rst, re.escape(latex_expected) + '$')
|
||||
|
||||
return verify_
|
||||
|
||||
|
||||
@@ -147,282 +152,343 @@ def get_verifier(verify, verify_re):
|
||||
|
||||
def get(name):
|
||||
return v[name]
|
||||
|
||||
return get
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('type', 'rst', 'html_expected', 'latex_expected'), [
|
||||
(
|
||||
# pep role
|
||||
'verify',
|
||||
':pep:`8`',
|
||||
('<p><span class="target" id="index-0"></span><a class="pep reference external" '
|
||||
'href="https://peps.python.org/pep-0008/"><strong>PEP 8</strong></a></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}'
|
||||
'!PEP 8@\\spxentry{PEP 8}}\\sphinxhref{https://peps.python.org/pep-0008/}'
|
||||
'{\\sphinxstylestrong{PEP 8}}'),
|
||||
),
|
||||
(
|
||||
# pep role with anchor
|
||||
'verify',
|
||||
':pep:`8#id1`',
|
||||
('<p><span class="target" id="index-0"></span><a class="pep reference external" '
|
||||
'href="https://peps.python.org/pep-0008/#id1">'
|
||||
'<strong>PEP 8#id1</strong></a></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}'
|
||||
'!PEP 8\\#id1@\\spxentry{PEP 8\\#id1}}\\sphinxhref'
|
||||
'{https://peps.python.org/pep-0008/\\#id1}'
|
||||
'{\\sphinxstylestrong{PEP 8\\#id1}}'),
|
||||
),
|
||||
(
|
||||
# rfc role
|
||||
'verify',
|
||||
':rfc:`2324`',
|
||||
('<p><span class="target" id="index-0"></span><a class="rfc reference external" '
|
||||
'href="https://datatracker.ietf.org/doc/html/rfc2324.html"><strong>RFC 2324</strong></a></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\index{RFC@\\spxentry{RFC}!RFC 2324@\\spxentry{RFC 2324}}'
|
||||
'\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html}'
|
||||
'{\\sphinxstylestrong{RFC 2324}}'),
|
||||
),
|
||||
(
|
||||
# rfc role with anchor
|
||||
'verify',
|
||||
':rfc:`2324#id1`',
|
||||
('<p><span class="target" id="index-0"></span><a class="rfc reference external" '
|
||||
'href="https://datatracker.ietf.org/doc/html/rfc2324.html#id1">'
|
||||
'<strong>RFC 2324#id1</strong></a></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\index{RFC@\\spxentry{RFC}!RFC 2324\\#id1@\\spxentry{RFC 2324\\#id1}}'
|
||||
'\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html\\#id1}'
|
||||
'{\\sphinxstylestrong{RFC 2324\\#id1}}'),
|
||||
),
|
||||
(
|
||||
# correct interpretation of code with whitespace
|
||||
'verify_re',
|
||||
'``code sample``',
|
||||
('<p><code class="(samp )?docutils literal notranslate"><span class="pre">'
|
||||
'code</span>   <span class="pre">sample</span></code></p>'),
|
||||
r'\\sphinxAtStartPar\n\\sphinxcode{\\sphinxupquote{code sample}}',
|
||||
),
|
||||
(
|
||||
# interpolation of arrows in menuselection
|
||||
'verify',
|
||||
':menuselection:`a --> b`',
|
||||
('<p><span class="menuselection">a \N{TRIANGULAR BULLET} b</span></p>'),
|
||||
'\\sphinxAtStartPar\n\\sphinxmenuselection{a \\(\\rightarrow\\) b}',
|
||||
),
|
||||
(
|
||||
# interpolation of ampersands in menuselection
|
||||
'verify',
|
||||
':menuselection:`&Foo -&&- &Bar`',
|
||||
('<p><span class="menuselection"><span class="accelerator">F</span>oo '
|
||||
'-&- <span class="accelerator">B</span>ar</span></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
r'\sphinxmenuselection{\sphinxaccelerator{F}oo \sphinxhyphen{}'
|
||||
r'\&\sphinxhyphen{} \sphinxaccelerator{B}ar}'),
|
||||
),
|
||||
(
|
||||
# interpolation of ampersands in guilabel
|
||||
'verify',
|
||||
':guilabel:`&Foo -&&- &Bar`',
|
||||
('<p><span class="guilabel"><span class="accelerator">F</span>oo '
|
||||
'-&- <span class="accelerator">B</span>ar</span></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
r'\sphinxguilabel{\sphinxaccelerator{F}oo \sphinxhyphen{}\&\sphinxhyphen{} \sphinxaccelerator{B}ar}'),
|
||||
),
|
||||
(
|
||||
# no ampersands in guilabel
|
||||
'verify',
|
||||
':guilabel:`Foo`',
|
||||
'<p><span class="guilabel">Foo</span></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxguilabel{Foo}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`space`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">space</kbd></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{space}}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Control+X`',
|
||||
('<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">Control</kbd>'
|
||||
'+'
|
||||
'<kbd class="kbd docutils literal notranslate">X</kbd>'
|
||||
'</kbd></p>'),
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{Control+X}}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Alt+^`',
|
||||
('<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">Alt</kbd>'
|
||||
'+'
|
||||
'<kbd class="kbd docutils literal notranslate">^</kbd>'
|
||||
'</kbd></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{Alt+\\textasciicircum{}}}'),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`M-x M-s`',
|
||||
('<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">M</kbd>'
|
||||
'-'
|
||||
'<kbd class="kbd docutils literal notranslate">x</kbd>'
|
||||
' '
|
||||
'<kbd class="kbd docutils literal notranslate">M</kbd>'
|
||||
'-'
|
||||
'<kbd class="kbd docutils literal notranslate">s</kbd>'
|
||||
'</kbd></p>'),
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{M\\sphinxhyphen{}x M\\sphinxhyphen{}s}}'),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`-`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">-</kbd></p>',
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{\\sphinxhyphen{}}}'),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Caps Lock`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">Caps Lock</kbd></p>',
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{Caps Lock}}'),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`sys rq`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">sys rq</kbd></p>',
|
||||
('\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{sys rq}}'),
|
||||
),
|
||||
(
|
||||
# non-interpolation of dashes in option role
|
||||
'verify_re',
|
||||
':option:`--with-option`',
|
||||
('<p><code( class="xref std std-option docutils literal notranslate")?>'
|
||||
'<span class="pre">--with-option</span></code></p>$'),
|
||||
(r'\\sphinxAtStartPar\n'
|
||||
r'\\sphinxcode{\\sphinxupquote{\\sphinxhyphen{}\\sphinxhyphen{}with\\sphinxhyphen{}option}}$'),
|
||||
),
|
||||
(
|
||||
# verify smarty-pants quotes
|
||||
'verify',
|
||||
'"John"',
|
||||
'<p>“John”</p>',
|
||||
"\\sphinxAtStartPar\n“John”",
|
||||
),
|
||||
(
|
||||
# ... but not in literal text
|
||||
'verify',
|
||||
'``"John"``',
|
||||
('<p><code class="docutils literal notranslate"><span class="pre">'
|
||||
'"John"</span></code></p>'),
|
||||
'\\sphinxAtStartPar\n\\sphinxcode{\\sphinxupquote{"John"}}',
|
||||
),
|
||||
(
|
||||
# verify classes for inline roles
|
||||
'verify',
|
||||
':manpage:`mp(1)`',
|
||||
'<p><em class="manpage">mp(1)</em></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxstyleliteralemphasis{\\sphinxupquote{mp(1)}}',
|
||||
),
|
||||
(
|
||||
# correct escaping in normal mode
|
||||
'verify',
|
||||
'Γ\\\\∞$',
|
||||
None,
|
||||
'\\sphinxAtStartPar\nΓ\\textbackslash{}\\(\\infty\\)\\$',
|
||||
),
|
||||
(
|
||||
# in verbatim code fragments
|
||||
'verify',
|
||||
'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
('\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
'@Γ\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
'\\end{sphinxVerbatim}'),
|
||||
),
|
||||
(
|
||||
# in URIs
|
||||
'verify_re',
|
||||
'`test <https://www.google.com/~me/>`_',
|
||||
None,
|
||||
r'\\sphinxAtStartPar\n\\sphinxhref{https://www.google.com/~me/}{test}.*',
|
||||
),
|
||||
(
|
||||
# description list: simple
|
||||
'verify',
|
||||
'term\n description',
|
||||
'<dl class="simple">\n<dt>term</dt><dd><p>description</p>\n</dd>\n</dl>',
|
||||
None,
|
||||
),
|
||||
(
|
||||
# description list: with classifiers
|
||||
'verify',
|
||||
'term : class1 : class2\n description',
|
||||
('<dl class="simple">\n<dt>term<span class="classifier">class1</span>'
|
||||
'<span class="classifier">class2</span></dt><dd><p>description</p>\n</dd>\n</dl>'),
|
||||
None,
|
||||
),
|
||||
(
|
||||
# glossary (description list): multiple terms
|
||||
'verify',
|
||||
'.. glossary::\n\n term1\n term2\n description',
|
||||
('<dl class="simple glossary">\n'
|
||||
'<dt id="term-term1">term1<a class="headerlink" href="#term-term1"'
|
||||
' title="Link to this term">¶</a></dt>'
|
||||
'<dt id="term-term2">term2<a class="headerlink" href="#term-term2"'
|
||||
' title="Link to this term">¶</a></dt>'
|
||||
'<dd><p>description</p>\n</dd>\n</dl>'),
|
||||
None,
|
||||
),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
('type', 'rst', 'html_expected', 'latex_expected'),
|
||||
[
|
||||
(
|
||||
# pep role
|
||||
'verify',
|
||||
':pep:`8`',
|
||||
(
|
||||
'<p><span class="target" id="index-0"></span><a class="pep reference external" '
|
||||
'href="https://peps.python.org/pep-0008/"><strong>PEP 8</strong></a></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}'
|
||||
'!PEP 8@\\spxentry{PEP 8}}\\sphinxhref{https://peps.python.org/pep-0008/}'
|
||||
'{\\sphinxstylestrong{PEP 8}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# pep role with anchor
|
||||
'verify',
|
||||
':pep:`8#id1`',
|
||||
(
|
||||
'<p><span class="target" id="index-0"></span><a class="pep reference external" '
|
||||
'href="https://peps.python.org/pep-0008/#id1">'
|
||||
'<strong>PEP 8#id1</strong></a></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}'
|
||||
'!PEP 8\\#id1@\\spxentry{PEP 8\\#id1}}\\sphinxhref'
|
||||
'{https://peps.python.org/pep-0008/\\#id1}'
|
||||
'{\\sphinxstylestrong{PEP 8\\#id1}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# rfc role
|
||||
'verify',
|
||||
':rfc:`2324`',
|
||||
(
|
||||
'<p><span class="target" id="index-0"></span><a class="rfc reference external" '
|
||||
'href="https://datatracker.ietf.org/doc/html/rfc2324.html"><strong>RFC 2324</strong></a></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\index{RFC@\\spxentry{RFC}!RFC 2324@\\spxentry{RFC 2324}}'
|
||||
'\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html}'
|
||||
'{\\sphinxstylestrong{RFC 2324}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# rfc role with anchor
|
||||
'verify',
|
||||
':rfc:`2324#id1`',
|
||||
(
|
||||
'<p><span class="target" id="index-0"></span><a class="rfc reference external" '
|
||||
'href="https://datatracker.ietf.org/doc/html/rfc2324.html#id1">'
|
||||
'<strong>RFC 2324#id1</strong></a></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\index{RFC@\\spxentry{RFC}!RFC 2324\\#id1@\\spxentry{RFC 2324\\#id1}}'
|
||||
'\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html\\#id1}'
|
||||
'{\\sphinxstylestrong{RFC 2324\\#id1}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# correct interpretation of code with whitespace
|
||||
'verify_re',
|
||||
'``code sample``',
|
||||
(
|
||||
'<p><code class="(samp )?docutils literal notranslate"><span class="pre">'
|
||||
'code</span>   <span class="pre">sample</span></code></p>'
|
||||
),
|
||||
r'\\sphinxAtStartPar\n\\sphinxcode{\\sphinxupquote{code sample}}',
|
||||
),
|
||||
(
|
||||
# interpolation of arrows in menuselection
|
||||
'verify',
|
||||
':menuselection:`a --> b`',
|
||||
'<p><span class="menuselection">a \N{TRIANGULAR BULLET} b</span></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxmenuselection{a \\(\\rightarrow\\) b}',
|
||||
),
|
||||
(
|
||||
# interpolation of ampersands in menuselection
|
||||
'verify',
|
||||
':menuselection:`&Foo -&&- &Bar`',
|
||||
(
|
||||
'<p><span class="menuselection"><span class="accelerator">F</span>oo '
|
||||
'-&- <span class="accelerator">B</span>ar</span></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
r'\sphinxmenuselection{\sphinxaccelerator{F}oo \sphinxhyphen{}'
|
||||
r'\&\sphinxhyphen{} \sphinxaccelerator{B}ar}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# interpolation of ampersands in guilabel
|
||||
'verify',
|
||||
':guilabel:`&Foo -&&- &Bar`',
|
||||
(
|
||||
'<p><span class="guilabel"><span class="accelerator">F</span>oo '
|
||||
'-&- <span class="accelerator">B</span>ar</span></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
r'\sphinxguilabel{\sphinxaccelerator{F}oo \sphinxhyphen{}\&\sphinxhyphen{} \sphinxaccelerator{B}ar}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# no ampersands in guilabel
|
||||
'verify',
|
||||
':guilabel:`Foo`',
|
||||
'<p><span class="guilabel">Foo</span></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxguilabel{Foo}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`space`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">space</kbd></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{space}}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Control+X`',
|
||||
(
|
||||
'<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">Control</kbd>'
|
||||
'+'
|
||||
'<kbd class="kbd docutils literal notranslate">X</kbd>'
|
||||
'</kbd></p>'
|
||||
),
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{Control+X}}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Alt+^`',
|
||||
(
|
||||
'<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">Alt</kbd>'
|
||||
'+'
|
||||
'<kbd class="kbd docutils literal notranslate">^</kbd>'
|
||||
'</kbd></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{Alt+\\textasciicircum{}}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`M-x M-s`',
|
||||
(
|
||||
'<p><kbd class="kbd compound docutils literal notranslate">'
|
||||
'<kbd class="kbd docutils literal notranslate">M</kbd>'
|
||||
'-'
|
||||
'<kbd class="kbd docutils literal notranslate">x</kbd>'
|
||||
' '
|
||||
'<kbd class="kbd docutils literal notranslate">M</kbd>'
|
||||
'-'
|
||||
'<kbd class="kbd docutils literal notranslate">s</kbd>'
|
||||
'</kbd></p>'
|
||||
),
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{M\\sphinxhyphen{}x M\\sphinxhyphen{}s}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`-`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">-</kbd></p>',
|
||||
(
|
||||
'\\sphinxAtStartPar\n'
|
||||
'\\sphinxkeyboard{\\sphinxupquote{\\sphinxhyphen{}}}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`Caps Lock`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">Caps Lock</kbd></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{Caps Lock}}',
|
||||
),
|
||||
(
|
||||
# kbd role
|
||||
'verify',
|
||||
':kbd:`sys rq`',
|
||||
'<p><kbd class="kbd docutils literal notranslate">sys rq</kbd></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxkeyboard{\\sphinxupquote{sys rq}}',
|
||||
),
|
||||
(
|
||||
# non-interpolation of dashes in option role
|
||||
'verify_re',
|
||||
':option:`--with-option`',
|
||||
(
|
||||
'<p><code( class="xref std std-option docutils literal notranslate")?>'
|
||||
'<span class="pre">--with-option</span></code></p>$'
|
||||
),
|
||||
(
|
||||
r'\\sphinxAtStartPar\n'
|
||||
r'\\sphinxcode{\\sphinxupquote{\\sphinxhyphen{}\\sphinxhyphen{}with\\sphinxhyphen{}option}}$'
|
||||
),
|
||||
),
|
||||
(
|
||||
# verify smarty-pants quotes
|
||||
'verify',
|
||||
'"John"',
|
||||
'<p>“John”</p>',
|
||||
'\\sphinxAtStartPar\n“John”',
|
||||
),
|
||||
(
|
||||
# ... but not in literal text
|
||||
'verify',
|
||||
'``"John"``',
|
||||
(
|
||||
'<p><code class="docutils literal notranslate"><span class="pre">'
|
||||
'"John"</span></code></p>'
|
||||
),
|
||||
'\\sphinxAtStartPar\n\\sphinxcode{\\sphinxupquote{"John"}}',
|
||||
),
|
||||
(
|
||||
# verify classes for inline roles
|
||||
'verify',
|
||||
':manpage:`mp(1)`',
|
||||
'<p><em class="manpage">mp(1)</em></p>',
|
||||
'\\sphinxAtStartPar\n\\sphinxstyleliteralemphasis{\\sphinxupquote{mp(1)}}',
|
||||
),
|
||||
(
|
||||
# correct escaping in normal mode
|
||||
'verify',
|
||||
'Γ\\\\∞$',
|
||||
None,
|
||||
'\\sphinxAtStartPar\nΓ\\textbackslash{}\\(\\infty\\)\\$',
|
||||
),
|
||||
(
|
||||
# in verbatim code fragments
|
||||
'verify',
|
||||
'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
(
|
||||
'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
'@Γ\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
'\\end{sphinxVerbatim}'
|
||||
),
|
||||
),
|
||||
(
|
||||
# in URIs
|
||||
'verify_re',
|
||||
'`test <https://www.google.com/~me/>`_',
|
||||
None,
|
||||
r'\\sphinxAtStartPar\n\\sphinxhref{https://www.google.com/~me/}{test}.*',
|
||||
),
|
||||
(
|
||||
# description list: simple
|
||||
'verify',
|
||||
'term\n description',
|
||||
'<dl class="simple">\n<dt>term</dt><dd><p>description</p>\n</dd>\n</dl>',
|
||||
None,
|
||||
),
|
||||
(
|
||||
# description list: with classifiers
|
||||
'verify',
|
||||
'term : class1 : class2\n description',
|
||||
(
|
||||
'<dl class="simple">\n<dt>term<span class="classifier">class1</span>'
|
||||
'<span class="classifier">class2</span></dt><dd><p>description</p>\n</dd>\n</dl>'
|
||||
),
|
||||
None,
|
||||
),
|
||||
(
|
||||
# glossary (description list): multiple terms
|
||||
'verify',
|
||||
'.. glossary::\n\n term1\n term2\n description',
|
||||
(
|
||||
'<dl class="simple glossary">\n'
|
||||
'<dt id="term-term1">term1<a class="headerlink" href="#term-term1"'
|
||||
' title="Link to this term">¶</a></dt>'
|
||||
'<dt id="term-term2">term2<a class="headerlink" href="#term-term2"'
|
||||
' title="Link to this term">¶</a></dt>'
|
||||
'<dd><p>description</p>\n</dd>\n</dl>'
|
||||
),
|
||||
None,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_inline(get_verifier, type, rst, html_expected, latex_expected):
|
||||
verifier = get_verifier(type)
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('type', 'rst', 'html_expected', 'latex_expected'), [
|
||||
(
|
||||
'verify',
|
||||
r'4 backslashes \\\\',
|
||||
r'<p>4 backslashes \\</p>',
|
||||
None,
|
||||
),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
('type', 'rst', 'html_expected', 'latex_expected'),
|
||||
[
|
||||
(
|
||||
'verify',
|
||||
r'4 backslashes \\\\',
|
||||
r'<p>4 backslashes \\</p>',
|
||||
None,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_inline_docutils16(get_verifier, type, rst, html_expected, latex_expected):
|
||||
verifier = get_verifier(type)
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'latex_engine': 'xelatex'})
|
||||
@pytest.mark.parametrize(('type', 'rst', 'html_expected', 'latex_expected'), [
|
||||
(
|
||||
# in verbatim code fragments
|
||||
'verify',
|
||||
'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
('\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
'@Γ\\PYGZbs{}∞\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
'\\end{sphinxVerbatim}'),
|
||||
),
|
||||
])
|
||||
def test_inline_for_unicode_latex_engine(get_verifier, type, rst,
|
||||
html_expected, latex_expected):
|
||||
@pytest.mark.parametrize(
|
||||
('type', 'rst', 'html_expected', 'latex_expected'),
|
||||
[
|
||||
(
|
||||
# in verbatim code fragments
|
||||
'verify',
|
||||
'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
(
|
||||
'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
'@Γ\\PYGZbs{}∞\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
'\\end{sphinxVerbatim}'
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_inline_for_unicode_latex_engine(
|
||||
get_verifier, type, rst, html_expected, latex_expected
|
||||
):
|
||||
verifier = get_verifier(type)
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
|
||||
@@ -431,49 +497,68 @@ def test_samp_role(parse):
|
||||
# no braces
|
||||
text = ':samp:`a{b}c`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, ("a",
|
||||
[nodes.emphasis, "b"],
|
||||
"c")])
|
||||
assert_node(
|
||||
doctree[0], [nodes.paragraph, nodes.literal, ('a', [nodes.emphasis, 'b'], 'c')]
|
||||
)
|
||||
# nested braces
|
||||
text = ':samp:`a{{b}}c`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, ("a",
|
||||
[nodes.emphasis, "{b"],
|
||||
"}c")])
|
||||
assert_node(
|
||||
doctree[0],
|
||||
[nodes.paragraph, nodes.literal, ('a', [nodes.emphasis, '{b'], '}c')],
|
||||
)
|
||||
|
||||
# half-opened braces
|
||||
text = ':samp:`a{bc`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, "a{bc"])
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, 'a{bc'])
|
||||
|
||||
# escaped braces
|
||||
text = ':samp:`a\\\\{b}c`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, "a{b}c"])
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, 'a{b}c'])
|
||||
|
||||
# no braces (whitespaces are keeped as is)
|
||||
text = ':samp:`code sample`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, "code sample"])
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, 'code sample'])
|
||||
|
||||
|
||||
def test_download_role(parse):
|
||||
# implicit
|
||||
text = ':download:`sphinx.rst`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, addnodes.download_reference,
|
||||
nodes.literal, "sphinx.rst"])
|
||||
assert_node(doctree[0][0], refdoc='dummy', refdomain='', reftype='download',
|
||||
refexplicit=False, reftarget='sphinx.rst', refwarn=False)
|
||||
assert_node(
|
||||
doctree[0],
|
||||
[nodes.paragraph, addnodes.download_reference, nodes.literal, 'sphinx.rst'],
|
||||
)
|
||||
assert_node(
|
||||
doctree[0][0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='download',
|
||||
refexplicit=False,
|
||||
reftarget='sphinx.rst',
|
||||
refwarn=False,
|
||||
)
|
||||
assert_node(doctree[0][0][0], classes=['xref', 'download'])
|
||||
|
||||
# explicit
|
||||
text = ':download:`reftitle <sphinx.rst>`'
|
||||
doctree = parse(text)
|
||||
assert_node(doctree[0], [nodes.paragraph, addnodes.download_reference,
|
||||
nodes.literal, "reftitle"])
|
||||
assert_node(doctree[0][0], refdoc='dummy', refdomain='', reftype='download',
|
||||
refexplicit=True, reftarget='sphinx.rst', refwarn=False)
|
||||
assert_node(
|
||||
doctree[0],
|
||||
[nodes.paragraph, addnodes.download_reference, nodes.literal, 'reftitle'],
|
||||
)
|
||||
assert_node(
|
||||
doctree[0][0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='download',
|
||||
refexplicit=True,
|
||||
reftarget='sphinx.rst',
|
||||
refwarn=False,
|
||||
)
|
||||
assert_node(doctree[0][0][0], classes=['xref', 'download'])
|
||||
|
||||
|
||||
@@ -484,15 +569,29 @@ def test_XRefRole(inliner):
|
||||
doctrees, errors = role('ref', 'rawtext', 'text', 5, inliner, {}, [])
|
||||
assert len(doctrees) == 1
|
||||
assert_node(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text'])
|
||||
assert_node(doctrees[0], refdoc='dummy', refdomain='', reftype='ref', reftarget='text',
|
||||
refexplicit=False, refwarn=False)
|
||||
assert_node(
|
||||
doctrees[0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='ref',
|
||||
reftarget='text',
|
||||
refexplicit=False,
|
||||
refwarn=False,
|
||||
)
|
||||
assert errors == []
|
||||
|
||||
# explicit
|
||||
doctrees, errors = role('ref', 'rawtext', 'title <target>', 5, inliner, {}, [])
|
||||
assert_node(doctrees[0], [addnodes.pending_xref, nodes.literal, 'title'])
|
||||
assert_node(doctrees[0], refdoc='dummy', refdomain='', reftype='ref', reftarget='target',
|
||||
refexplicit=True, refwarn=False)
|
||||
assert_node(
|
||||
doctrees[0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='ref',
|
||||
reftarget='target',
|
||||
refexplicit=True,
|
||||
refwarn=False,
|
||||
)
|
||||
|
||||
# bang
|
||||
doctrees, errors = role('ref', 'rawtext', '!title <target>', 5, inliner, {}, [])
|
||||
@@ -501,22 +600,43 @@ def test_XRefRole(inliner):
|
||||
# refdomain
|
||||
doctrees, errors = role('test:doc', 'rawtext', 'text', 5, inliner, {}, [])
|
||||
assert_node(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text'])
|
||||
assert_node(doctrees[0], refdoc='dummy', refdomain='test', reftype='doc', reftarget='text',
|
||||
refexplicit=False, refwarn=False)
|
||||
assert_node(
|
||||
doctrees[0],
|
||||
refdoc='dummy',
|
||||
refdomain='test',
|
||||
reftype='doc',
|
||||
reftarget='text',
|
||||
refexplicit=False,
|
||||
refwarn=False,
|
||||
)
|
||||
|
||||
# fix_parens
|
||||
role = XRefRole(fix_parens=True)
|
||||
doctrees, errors = role('ref', 'rawtext', 'text()', 5, inliner, {}, [])
|
||||
assert_node(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text()'])
|
||||
assert_node(doctrees[0], refdoc='dummy', refdomain='', reftype='ref', reftarget='text',
|
||||
refexplicit=False, refwarn=False)
|
||||
assert_node(
|
||||
doctrees[0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='ref',
|
||||
reftarget='text',
|
||||
refexplicit=False,
|
||||
refwarn=False,
|
||||
)
|
||||
|
||||
# lowercase
|
||||
role = XRefRole(lowercase=True)
|
||||
doctrees, errors = role('ref', 'rawtext', 'TEXT', 5, inliner, {}, [])
|
||||
assert_node(doctrees[0], [addnodes.pending_xref, nodes.literal, 'TEXT'])
|
||||
assert_node(doctrees[0], refdoc='dummy', refdomain='', reftype='ref', reftarget='text',
|
||||
refexplicit=False, refwarn=False)
|
||||
assert_node(
|
||||
doctrees[0],
|
||||
refdoc='dummy',
|
||||
refdomain='',
|
||||
reftype='ref',
|
||||
reftarget='text',
|
||||
refexplicit=False,
|
||||
refwarn=False,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', testroot='prolog')
|
||||
@@ -552,8 +672,11 @@ def test_keep_warnings_is_True(app):
|
||||
assert_node(doctree[0][1], nodes.system_message)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', testroot='keep_warnings',
|
||||
confoverrides={'keep_warnings': False})
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='keep_warnings',
|
||||
confoverrides={'keep_warnings': False},
|
||||
)
|
||||
def test_keep_warnings_is_False(app):
|
||||
app.build(force_all=True)
|
||||
doctree = app.env.get_doctree('index')
|
||||
@@ -589,7 +712,7 @@ def test_default_role1(app):
|
||||
assert_node(doctree[0][1], nodes.paragraph)
|
||||
assert_node(doctree[0][1][0], addnodes.index)
|
||||
assert_node(doctree[0][1][1], nodes.target)
|
||||
assert_node(doctree[0][1][2], nodes.reference, classes=["pep"])
|
||||
assert_node(doctree[0][1][2], nodes.reference, classes=['pep'])
|
||||
|
||||
# no default-role
|
||||
doctree = app.env.get_doctree('foo')
|
||||
@@ -599,8 +722,11 @@ def test_default_role1(app):
|
||||
assert_node(doctree[0][1][1], nodes.Text)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', testroot='default_role',
|
||||
confoverrides={'default_role': 'guilabel'})
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='default_role',
|
||||
confoverrides={'default_role': 'guilabel'},
|
||||
)
|
||||
def test_default_role2(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -610,11 +736,11 @@ def test_default_role2(app):
|
||||
assert_node(doctree[0][1], nodes.paragraph)
|
||||
assert_node(doctree[0][1][0], addnodes.index)
|
||||
assert_node(doctree[0][1][1], nodes.target)
|
||||
assert_node(doctree[0][1][2], nodes.reference, classes=["pep"])
|
||||
assert_node(doctree[0][1][2], nodes.reference, classes=['pep'])
|
||||
|
||||
# default_role changes the default behavior
|
||||
doctree = app.env.get_doctree('foo')
|
||||
assert_node(doctree[0], nodes.section)
|
||||
assert_node(doctree[0][1], nodes.paragraph)
|
||||
assert_node(doctree[0][1][0], nodes.inline, classes=["guilabel"])
|
||||
assert_node(doctree[0][1][0], nodes.inline, classes=['guilabel'])
|
||||
assert_node(doctree[0][1][1], nodes.Text)
|
||||
|
@@ -21,17 +21,21 @@ def test_docinfo(app):
|
||||
'authors': ['Me', 'Myself', 'I'],
|
||||
'address': '123 Example Street\nExample, EX Canada\nA1B 2C3',
|
||||
'field name': 'This is a generic bibliographic field.',
|
||||
'field name 2': ('Generic bibliographic fields may contain multiple '
|
||||
'body elements.\n\nLike this.'),
|
||||
'field name 2': (
|
||||
'Generic bibliographic fields may contain multiple '
|
||||
'body elements.\n\nLike this.'
|
||||
),
|
||||
'status': 'This is a “work in progress”',
|
||||
'version': '1',
|
||||
'copyright': ('This document has been placed in the public domain. '
|
||||
'You\nmay do with it as you wish. You may copy, modify,'
|
||||
'\nredistribute, reattribute, sell, buy, rent, lease,\n'
|
||||
'destroy, or improve it, quote it at length, excerpt,\n'
|
||||
'incorporate, collate, fold, staple, or mutilate it, or '
|
||||
'do\nanything else to it that your or anyone else’s '
|
||||
'heart\ndesires.'),
|
||||
'copyright': (
|
||||
'This document has been placed in the public domain. '
|
||||
'You\nmay do with it as you wish. You may copy, modify,'
|
||||
'\nredistribute, reattribute, sell, buy, rent, lease,\n'
|
||||
'destroy, or improve it, quote it at length, excerpt,\n'
|
||||
'incorporate, collate, fold, staple, or mutilate it, or '
|
||||
'do\nanything else to it that your or anyone else’s '
|
||||
'heart\ndesires.'
|
||||
),
|
||||
'contact': 'goodger@python.org',
|
||||
'date': '2006-05-21',
|
||||
'organization': 'humankind',
|
||||
|
@@ -17,41 +17,47 @@ def test_RSTParser_prolog_epilog(RSTStateMachine, app):
|
||||
parser.set_application(app)
|
||||
|
||||
# normal case
|
||||
text = ('hello Sphinx world\n'
|
||||
'Sphinx is a document generator')
|
||||
text = 'hello Sphinx world\nSphinx is a document generator'
|
||||
parser.parse(text, document)
|
||||
(content, _), _ = RSTStateMachine().run.call_args
|
||||
|
||||
assert list(content.xitems()) == [('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator')]
|
||||
assert list(content.xitems()) == [
|
||||
('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator'),
|
||||
]
|
||||
|
||||
# with rst_prolog
|
||||
app.env.config.rst_prolog = 'this is rst_prolog\nhello reST!'
|
||||
parser.parse(text, document)
|
||||
(content, _), _ = RSTStateMachine().run.call_args
|
||||
assert list(content.xitems()) == [('<rst_prolog>', 0, 'this is rst_prolog'),
|
||||
('<rst_prolog>', 1, 'hello reST!'),
|
||||
('<generated>', 0, ''),
|
||||
('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator')]
|
||||
assert list(content.xitems()) == [
|
||||
('<rst_prolog>', 0, 'this is rst_prolog'),
|
||||
('<rst_prolog>', 1, 'hello reST!'),
|
||||
('<generated>', 0, ''),
|
||||
('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator'),
|
||||
]
|
||||
|
||||
# with rst_epilog
|
||||
app.env.config.rst_prolog = None
|
||||
app.env.config.rst_epilog = 'this is rst_epilog\ngood-bye reST!'
|
||||
parser.parse(text, document)
|
||||
(content, _), _ = RSTStateMachine().run.call_args
|
||||
assert list(content.xitems()) == [('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator'),
|
||||
('dummy.rst', 2, ''),
|
||||
('<rst_epilog>', 0, 'this is rst_epilog'),
|
||||
('<rst_epilog>', 1, 'good-bye reST!')]
|
||||
assert list(content.xitems()) == [
|
||||
('dummy.rst', 0, 'hello Sphinx world'),
|
||||
('dummy.rst', 1, 'Sphinx is a document generator'),
|
||||
('dummy.rst', 2, ''),
|
||||
('<rst_epilog>', 0, 'this is rst_epilog'),
|
||||
('<rst_epilog>', 1, 'good-bye reST!'),
|
||||
]
|
||||
|
||||
# expandtabs / convert whitespaces
|
||||
app.env.config.rst_prolog = None
|
||||
app.env.config.rst_epilog = None
|
||||
text = ('\thello Sphinx world\n'
|
||||
'\v\fSphinx is a document generator')
|
||||
text = '\thello Sphinx world\n\v\fSphinx is a document generator'
|
||||
parser.parse(text, document)
|
||||
(content, _), _ = RSTStateMachine().run.call_args
|
||||
assert list(content.xitems()) == [('dummy.rst', 0, ' hello Sphinx world'),
|
||||
('dummy.rst', 1, ' Sphinx is a document generator')]
|
||||
assert list(content.xitems()) == [
|
||||
('dummy.rst', 0, ' hello Sphinx world'),
|
||||
('dummy.rst', 1, ' Sphinx is a document generator'),
|
||||
]
|
||||
|
@@ -5,7 +5,11 @@ import pytest
|
||||
from sphinx.testing.util import etree_parse
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True)
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_basic(app):
|
||||
app.build()
|
||||
|
||||
@@ -13,7 +17,11 @@ def test_basic(app):
|
||||
assert '<p>– “Sphinx” is a tool that makes it easy …</p>' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True)
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_literals(app):
|
||||
app.build()
|
||||
|
||||
@@ -29,7 +37,11 @@ def test_literals(app):
|
||||
assert code_text == "literal with 'quotes'"
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='text', testroot='smartquotes', freshenv=True)
|
||||
@pytest.mark.sphinx(
|
||||
'text',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_text_builder(app):
|
||||
app.build()
|
||||
|
||||
@@ -37,7 +49,11 @@ def test_text_builder(app):
|
||||
assert '-- "Sphinx" is a tool that makes it easy ...' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='man', testroot='smartquotes', freshenv=True)
|
||||
@pytest.mark.sphinx(
|
||||
'man',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_man_builder(app):
|
||||
app.build()
|
||||
|
||||
@@ -45,7 +61,11 @@ def test_man_builder(app):
|
||||
assert r'\-\- \(dqSphinx\(dq is a tool that makes it easy ...' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='latex', testroot='smartquotes', freshenv=True)
|
||||
@pytest.mark.sphinx(
|
||||
'latex',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_latex_builder(app):
|
||||
app.build()
|
||||
|
||||
@@ -53,8 +73,12 @@ def test_latex_builder(app):
|
||||
assert '\\textendash{} “Sphinx” is a tool that makes it easy …' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True,
|
||||
confoverrides={'language': 'ja'})
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
confoverrides={'language': 'ja'},
|
||||
)
|
||||
def test_ja_html_builder(app):
|
||||
app.build()
|
||||
|
||||
@@ -62,8 +86,12 @@ def test_ja_html_builder(app):
|
||||
assert '<p>-- "Sphinx" is a tool that makes it easy ...</p>' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True,
|
||||
confoverrides={'smartquotes': False})
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
confoverrides={'smartquotes': False},
|
||||
)
|
||||
def test_smartquotes_disabled(app):
|
||||
app.build()
|
||||
|
||||
@@ -71,8 +99,12 @@ def test_smartquotes_disabled(app):
|
||||
assert '<p>-- "Sphinx" is a tool that makes it easy ...</p>' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True,
|
||||
confoverrides={'smartquotes_action': 'q'})
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
confoverrides={'smartquotes_action': 'q'},
|
||||
)
|
||||
def test_smartquotes_action(app):
|
||||
app.build()
|
||||
|
||||
@@ -80,8 +112,12 @@ def test_smartquotes_action(app):
|
||||
assert '<p>-- “Sphinx” is a tool that makes it easy ...</p>' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='smartquotes', freshenv=True,
|
||||
confoverrides={'language': 'ja', 'smartquotes_excludes': {}})
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
confoverrides={'language': 'ja', 'smartquotes_excludes': {}},
|
||||
)
|
||||
def test_smartquotes_excludes_language(app):
|
||||
app.build()
|
||||
|
||||
@@ -89,8 +125,12 @@ def test_smartquotes_excludes_language(app):
|
||||
assert '<p>– 「Sphinx」 is a tool that makes it easy …</p>' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='man', testroot='smartquotes', freshenv=True,
|
||||
confoverrides={'smartquotes_excludes': {}})
|
||||
@pytest.mark.sphinx(
|
||||
'man',
|
||||
testroot='smartquotes',
|
||||
freshenv=True,
|
||||
confoverrides={'smartquotes_excludes': {}},
|
||||
)
|
||||
def test_smartquotes_excludes_builders(app):
|
||||
app.build()
|
||||
|
||||
|
Reference in New Issue
Block a user