"""
    test_markup
    ~~~~~~~~~~~

    Test various Sphinx-specific markup extensions.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re

import pytest
from docutils import frontend, nodes, utils
from docutils.parsers.rst import Parser as RstParser

from sphinx import addnodes
from sphinx.builders.html.transforms import KeyboardTransform
from sphinx.builders.latex import LaTeXBuilder
from sphinx.roles import XRefRole
from sphinx.testing.util import Struct, assert_node
from sphinx.transforms import SphinxSmartQuotes
from sphinx.util import docutils, texescape
from sphinx.util.docutils import sphinx_domains
from sphinx.writers.html import HTMLTranslator, HTMLWriter
from sphinx.writers.latex import LaTeXTranslator, LaTeXWriter


@pytest.fixture
def settings(app):
    texescape.init()  # otherwise done by the latex builder
    optparser = frontend.OptionParser(
        components=(RstParser, HTMLWriter, LaTeXWriter))
    settings = optparser.get_default_values()
    settings.smart_quotes = True
    settings.env = app.builder.env
    settings.env.temp_data['docname'] = 'dummy'
    settings.contentsname = 'dummy'
    settings.rfc_base_url = 'http://tools.ietf.org/html/'
    domain_context = sphinx_domains(settings.env)
    domain_context.enable()
    yield settings
    domain_context.disable()


@pytest.fixture
def new_document(settings):
    def create():
        document = utils.new_document('test data', settings)
        document['file'] = 'dummy'
        return document

    return create


@pytest.fixture
def inliner(new_document):
    document = new_document()
    document.reporter.get_source_and_line = lambda line=1: ('dummy.rst', line)
    return Struct(document=document, reporter=document.reporter)


@pytest.fixture
def parse(new_document):
    def parse_(rst):
        document = new_document()
        parser = RstParser()
        parser.parse(rst, document)
        SphinxSmartQuotes(document, startnode=None).apply()
        for msg in document.traverse(nodes.system_message):
            if msg['level'] == 1:
                msg.replace_self([])
        return document
    return parse_


# since we're not resolving the markup afterwards, these nodes may remain
class ForgivingTranslator:
    def visit_pending_xref(self, node):
        pass

    def depart_pending_xref(self, node):
        pass


class ForgivingHTMLTranslator(HTMLTranslator, ForgivingTranslator):
    pass


class ForgivingLaTeXTranslator(LaTeXTranslator, ForgivingTranslator):
    pass


@pytest.fixture
def verify_re_html(app, parse):
    def verify(rst, html_expected):
        document = parse(rst)
        KeyboardTransform(document).apply()
        html_translator = ForgivingHTMLTranslator(document, app.builder)
        document.walkabout(html_translator)
        html_translated = ''.join(html_translator.fragment).strip()
        assert re.match(html_expected, html_translated), 'from ' + rst
    return verify


@pytest.fixture
def verify_re_latex(app, parse):
    def verify(rst, latex_expected):
        document = parse(rst)
        app.builder = LaTeXBuilder(app)
        app.builder.set_environment(app.env)
        app.builder.init()
        theme = app.builder.themes.get('manual')
        latex_translator = ForgivingLaTeXTranslator(document, app.builder, theme)
        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 ' + repr(rst)
    return verify


@pytest.fixture
def verify_re(verify_re_html, verify_re_latex):
    def verify_re_(rst, html_expected, latex_expected):
        if html_expected:
            verify_re_html(rst, html_expected)
        if latex_expected:
            verify_re_latex(rst, latex_expected)
    return verify_re_


@pytest.fixture
def verify(verify_re_html, verify_re_latex):
    def verify_(rst, html_expected, latex_expected):
        if html_expected:
            verify_re_html(rst, re.escape(html_expected) + '$')
        if latex_expected:
            verify_re_latex(rst, re.escape(latex_expected) + '$')
    return verify_


@pytest.fixture
def get_verifier(verify, verify_re):
    v = {
        'verify': verify,
        'verify_re': 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="http://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a></p>'),
        ('\\sphinxAtStartPar\n'
         '\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}'
         '!PEP 8@\\spxentry{PEP 8}}\\sphinxhref{http://www.python.org/dev/peps/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="http://www.python.org/dev/peps/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'
         '{http://www.python.org/dev/peps/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="http://tools.ietf.org/html/rfc2324.html"><strong>RFC 2324</strong></a></p>'),
        ('\\sphinxAtStartPar\n'
         '\\index{RFC@\\spxentry{RFC}!RFC 2324@\\spxentry{RFC 2324}}'
         '\\sphinxhref{http://tools.ietf.org/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="http://tools.ietf.org/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{http://tools.ietf.org/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>&#160;&#160; <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 '
         '-&amp;- <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 '
         '-&amp;- <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}}'),
    ),
    (
        # 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">'
         '&quot;John&quot;</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="docutils">\n<dt>term</dt><dd>description</dd>\n</dl>',
        None,
    ),
    (
        # description list: with classifiers
        'verify',
        'term : class1 : class2\n    description',
        ('<dl class="docutils">\n<dt>term<span class="classifier">class1</span>'
         '<span class="classifier">class2</span></dt><dd>description</dd>\n</dl>'),
        None,
    ),
    (
        # glossary (description list): multiple terms
        'verify',
        '.. glossary::\n\n   term1\n   term2\n       description',
        ('<dl class="glossary docutils">\n'
         '<dt id="term-term1">term1<a class="headerlink" href="#term-term1"'
         ' title="Permalink to this term">¶</a></dt>'
         '<dt id="term-term2">term2<a class="headerlink" href="#term-term2"'
         ' title="Permalink to this term">¶</a></dt>'
         '<dd>description</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.skipif(docutils.__version_info__ < (0, 16),
                    reason='docutils-0.16 or above is required')
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):
    verifier = get_verifier(type)
    verifier(rst, html_expected, latex_expected)


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")])
    # nested braces
    text = ':samp:`a{{b}}c`'
    doctree = parse(text)
    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"])

    # escaped braces
    text = ':samp:`a\\\\{b}c`'
    doctree = parse(text)
    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"])


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][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][0][0], classes=['xref', 'download'])


def test_XRefRole(inliner):
    role = XRefRole()

    # implicit
    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 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)

    # bang
    doctrees, errors = role('ref', 'rawtext', '!title <target>', 5, inliner, {}, [])
    assert_node(doctrees[0], [nodes.literal, 'title <target>'])

    # 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)

    # 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)

    # 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)


@pytest.mark.sphinx('dummy', testroot='prolog')
def test_rst_prolog(app, status, warning):
    app.builder.build_all()
    rst = app.env.get_doctree('restructuredtext')
    md = app.env.get_doctree('markdown')

    # rst_prolog
    assert_node(rst[0], nodes.paragraph)
    assert_node(rst[0][0], nodes.emphasis)
    assert_node(rst[0][0][0], nodes.Text)
    assert rst[0][0][0] == 'Hello world'

    # rst_epilog
    assert_node(rst[-1], nodes.section)
    assert_node(rst[-1][-1], nodes.paragraph)
    assert_node(rst[-1][-1][0], nodes.emphasis)
    assert_node(rst[-1][-1][0][0], nodes.Text)
    assert rst[-1][-1][0][0] == 'Good-bye world'

    # rst_prolog & rst_epilog on exlucding reST parser
    assert not md.rawsource.startswith('*Hello world*.')
    assert not md.rawsource.endswith('*Good-bye world*.\n')


@pytest.mark.sphinx('dummy', testroot='keep_warnings')
def test_keep_warnings_is_True(app, status, warning):
    app.builder.build_all()
    doctree = app.env.get_doctree('index')
    assert_node(doctree[0], nodes.section)
    assert len(doctree[0]) == 2
    assert_node(doctree[0][1], nodes.system_message)


@pytest.mark.sphinx('dummy', testroot='keep_warnings',
                    confoverrides={'keep_warnings': False})
def test_keep_warnings_is_False(app, status, warning):
    app.builder.build_all()
    doctree = app.env.get_doctree('index')
    assert_node(doctree[0], nodes.section)
    assert len(doctree[0]) == 1


@pytest.mark.sphinx('dummy', testroot='refonly_bullet_list')
def test_compact_refonly_bullet_list(app, status, warning):
    app.builder.build_all()
    doctree = app.env.get_doctree('index')
    assert_node(doctree[0], nodes.section)
    assert len(doctree[0]) == 5

    assert doctree[0][1].astext() == 'List A:'
    assert_node(doctree[0][2], nodes.bullet_list)
    assert_node(doctree[0][2][0][0], addnodes.compact_paragraph)
    assert doctree[0][2][0][0].astext() == 'genindex'

    assert doctree[0][3].astext() == 'List B:'
    assert_node(doctree[0][4], nodes.bullet_list)
    assert_node(doctree[0][4][0][0], nodes.paragraph)
    assert doctree[0][4][0][0].astext() == 'Hello'


@pytest.mark.sphinx('dummy', testroot='default_role')
def test_default_role1(app, status, warning):
    app.builder.build_all()

    # default-role: pep
    doctree = app.env.get_doctree('index')
    assert_node(doctree[0], nodes.section)
    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"])

    # no default-role
    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.title_reference)
    assert_node(doctree[0][1][1], nodes.Text)


@pytest.mark.sphinx('dummy', testroot='default_role',
                    confoverrides={'default_role': 'guilabel'})
def test_default_role2(app, status, warning):
    app.builder.build_all()

    # default-role directive is stronger than configratuion
    doctree = app.env.get_doctree('index')
    assert_node(doctree[0], nodes.section)
    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"])

    # 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][1], nodes.Text)

[((154, 1, 386, 2), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(154, 25, 154, 64): '"""type,rst,html_expected,latex_expected"""', (154, 66, 386, 1): '[(\'verify\', \':pep:`8`\',\n    \'<p><span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{Python Enhancement Proposals@\\\\spxentry{Python Enhancement Proposals}!PEP 8@\\\\spxentry{PEP 8}}\\\\sphinxhref{http://www.python.org/dev/peps/pep-0008}{\\\\sphinxstylestrong{PEP 8}}"""\n    ), (\'verify\', \':pep:`8#id1`\',\n    \'<p><span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008#id1"><strong>PEP 8#id1</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{Python Enhancement Proposals@\\\\spxentry{Python Enhancement Proposals}!PEP 8\\\\#id1@\\\\spxentry{PEP 8\\\\#id1}}\\\\sphinxhref{http://www.python.org/dev/peps/pep-0008\\\\#id1}{\\\\sphinxstylestrong{PEP 8\\\\#id1}}"""\n    ), (\'verify\', \':rfc:`2324`\',\n    \'<p><span class="target" id="index-0"></span><a class="rfc reference external" href="http://tools.ietf.org/html/rfc2324.html"><strong>RFC 2324</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{RFC@\\\\spxentry{RFC}!RFC 2324@\\\\spxentry{RFC 2324}}\\\\sphinxhref{http://tools.ietf.org/html/rfc2324.html}{\\\\sphinxstylestrong{RFC 2324}}"""\n    ), (\'verify\', \':rfc:`2324#id1`\',\n    \'<p><span class="target" id="index-0"></span><a class="rfc reference external" href="http://tools.ietf.org/html/rfc2324.html#id1"><strong>RFC 2324#id1</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{RFC@\\\\spxentry{RFC}!RFC 2324\\\\#id1@\\\\spxentry{RFC 2324\\\\#id1}}\\\\sphinxhref{http://tools.ietf.org/html/rfc2324.html\\\\#id1}{\\\\sphinxstylestrong{RFC 2324\\\\#id1}}"""\n    ), (\'verify_re\', \'``code   sample``\',\n    \'<p><code class="(samp )?docutils literal notranslate"><span class="pre">code</span>&#160;&#160; <span class="pre">sample</span></code></p>\'\n    ,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxcode{\\\\\\\\sphinxupquote{code   sample}}\'\n    ), (\'verify\', \':menuselection:`a --> b`\',\n    \'<p><span class="menuselection">a ‣ b</span></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxmenuselection{a \\\\(\\\\rightarrow\\\\) b}"""),\n    (\'verify\', \':menuselection:`&Foo -&&- &Bar`\',\n    \'<p><span class="menuselection"><span class="accelerator">F</span>oo -&amp;- <span class="accelerator">B</span>ar</span></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxmenuselection{\\\\sphinxaccelerator{F}oo \\\\sphinxhyphen{}\\\\&\\\\sphinxhyphen{} \\\\sphinxaccelerator{B}ar}"""\n    ), (\'verify\', \':guilabel:`&Foo -&&- &Bar`\',\n    \'<p><span class="guilabel"><span class="accelerator">F</span>oo -&amp;- <span class="accelerator">B</span>ar</span></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxguilabel{\\\\sphinxaccelerator{F}oo \\\\sphinxhyphen{}\\\\&\\\\sphinxhyphen{} \\\\sphinxaccelerator{B}ar}"""\n    ), (\'verify\', \':guilabel:`Foo`\',\n    \'<p><span class="guilabel">Foo</span></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxguilabel{Foo}"""), (\'verify\',\n    \':kbd:`space`\',\n    \'<p><kbd class="kbd docutils literal notranslate">space</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{space}}"""), (\n    \'verify\', \':kbd:`Control+X`\',\n    \'<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>\'\n    , """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Control+X}}"""\n    ), (\'verify\', \':kbd:`Alt+^`\',\n    \'<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>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Alt+\\\\textasciicircum{}}}"""\n    ), (\'verify\', \':kbd:`M-x  M-s`\',\n    \'<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>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{M\\\\sphinxhyphen{}x  M\\\\sphinxhyphen{}s}}"""\n    ), (\'verify\', \':kbd:`-`\',\n    \'<p><kbd class="kbd docutils literal notranslate">-</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{\\\\sphinxhyphen{}}}"""\n    ), (\'verify\', \':kbd:`Caps Lock`\',\n    \'<p><kbd class="kbd docutils literal notranslate">Caps Lock</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Caps Lock}}"""),\n    (\'verify_re\', \':option:`--with-option`\',\n    \'<p><code( class="xref std std-option docutils literal notranslate")?><span class="pre">--with-option</span></code></p>$\'\n    ,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxcode{\\\\\\\\sphinxupquote{\\\\\\\\sphinxhyphen{}\\\\\\\\sphinxhyphen{}with\\\\\\\\sphinxhyphen{}option}}$\'\n    ), (\'verify\', \'"John"\', \'<p>“John”</p>\',\n    """\\\\sphinxAtStartPar\n“John”"""), (\'verify\', \'``"John"``\',\n    \'<p><code class="docutils literal notranslate"><span class="pre">&quot;John&quot;</span></code></p>\'\n    , """\\\\sphinxAtStartPar\n\\\\sphinxcode{\\\\sphinxupquote{"John"}}"""), (\n    \'verify\', \':manpage:`mp(1)`\', \'<p><em class="manpage">mp(1)</em></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxstyleliteralemphasis{\\\\sphinxupquote{mp(1)}}"""\n    ), (\'verify\', \'Γ\\\\\\\\∞$\', None,\n    """\\\\sphinxAtStartPar\nΓ\\\\textbackslash{}\\\\(\\\\infty\\\\)\\\\$"""), (\'verify\',\n    \'::\\n\\n @Γ\\\\∞${}\', None,\n    """\\\\begin{sphinxVerbatim}[commandchars=\\\\\\\\\\\\{\\\\}]\n@Γ\\\\PYGZbs{}\\\\(\\\\infty\\\\)\\\\PYGZdl{}\\\\PYGZob{}\\\\PYGZcb{}\n\\\\end{sphinxVerbatim}"""\n    ), (\'verify_re\', \'`test <https://www.google.com/~me/>`_\', None,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxhref{https://www.google.com/~me/}{test}.*\'\n    ), (\'verify\', """term\n    description""",\n    \'<dl class="docutils">\\n<dt>term</dt><dd>description</dd>\\n</dl>\', None\n    ), (\'verify\', """term : class1 : class2\n    description""",\n    """<dl class="docutils">\n<dt>term<span class="classifier">class1</span><span class="classifier">class2</span></dt><dd>description</dd>\n</dl>"""\n    , None), (\'verify\',\n    """.. glossary::\n\n   term1\n   term2\n       description""",\n    """<dl class="glossary docutils">\n<dt id="term-term1">term1<a class="headerlink" href="#term-term1" title="Permalink to this term">¶</a></dt><dt id="term-term2">term2<a class="headerlink" href="#term-term2" title="Permalink to this term">¶</a></dt><dd>description</dd>\n</dl>"""\n    , None)]'}, {}), '(\'type,rst,html_expected,latex_expected\', [(\'verify\',\n    \':pep:`8`\',\n    \'<p><span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{Python Enhancement Proposals@\\\\spxentry{Python Enhancement Proposals}!PEP 8@\\\\spxentry{PEP 8}}\\\\sphinxhref{http://www.python.org/dev/peps/pep-0008}{\\\\sphinxstylestrong{PEP 8}}"""\n    ), (\'verify\', \':pep:`8#id1`\',\n    \'<p><span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008#id1"><strong>PEP 8#id1</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{Python Enhancement Proposals@\\\\spxentry{Python Enhancement Proposals}!PEP 8\\\\#id1@\\\\spxentry{PEP 8\\\\#id1}}\\\\sphinxhref{http://www.python.org/dev/peps/pep-0008\\\\#id1}{\\\\sphinxstylestrong{PEP 8\\\\#id1}}"""\n    ), (\'verify\', \':rfc:`2324`\',\n    \'<p><span class="target" id="index-0"></span><a class="rfc reference external" href="http://tools.ietf.org/html/rfc2324.html"><strong>RFC 2324</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{RFC@\\\\spxentry{RFC}!RFC 2324@\\\\spxentry{RFC 2324}}\\\\sphinxhref{http://tools.ietf.org/html/rfc2324.html}{\\\\sphinxstylestrong{RFC 2324}}"""\n    ), (\'verify\', \':rfc:`2324#id1`\',\n    \'<p><span class="target" id="index-0"></span><a class="rfc reference external" href="http://tools.ietf.org/html/rfc2324.html#id1"><strong>RFC 2324#id1</strong></a></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\index{RFC@\\\\spxentry{RFC}!RFC 2324\\\\#id1@\\\\spxentry{RFC 2324\\\\#id1}}\\\\sphinxhref{http://tools.ietf.org/html/rfc2324.html\\\\#id1}{\\\\sphinxstylestrong{RFC 2324\\\\#id1}}"""\n    ), (\'verify_re\', \'``code   sample``\',\n    \'<p><code class="(samp )?docutils literal notranslate"><span class="pre">code</span>&#160;&#160; <span class="pre">sample</span></code></p>\'\n    ,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxcode{\\\\\\\\sphinxupquote{code   sample}}\'\n    ), (\'verify\', \':menuselection:`a --> b`\',\n    \'<p><span class="menuselection">a ‣ b</span></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxmenuselection{a \\\\(\\\\rightarrow\\\\) b}"""),\n    (\'verify\', \':menuselection:`&Foo -&&- &Bar`\',\n    \'<p><span class="menuselection"><span class="accelerator">F</span>oo -&amp;- <span class="accelerator">B</span>ar</span></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxmenuselection{\\\\sphinxaccelerator{F}oo \\\\sphinxhyphen{}\\\\&\\\\sphinxhyphen{} \\\\sphinxaccelerator{B}ar}"""\n    ), (\'verify\', \':guilabel:`&Foo -&&- &Bar`\',\n    \'<p><span class="guilabel"><span class="accelerator">F</span>oo -&amp;- <span class="accelerator">B</span>ar</span></p>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxguilabel{\\\\sphinxaccelerator{F}oo \\\\sphinxhyphen{}\\\\&\\\\sphinxhyphen{} \\\\sphinxaccelerator{B}ar}"""\n    ), (\'verify\', \':guilabel:`Foo`\',\n    \'<p><span class="guilabel">Foo</span></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxguilabel{Foo}"""), (\'verify\',\n    \':kbd:`space`\',\n    \'<p><kbd class="kbd docutils literal notranslate">space</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{space}}"""), (\n    \'verify\', \':kbd:`Control+X`\',\n    \'<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>\'\n    , """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Control+X}}"""\n    ), (\'verify\', \':kbd:`Alt+^`\',\n    \'<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>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Alt+\\\\textasciicircum{}}}"""\n    ), (\'verify\', \':kbd:`M-x  M-s`\',\n    \'<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>\'\n    ,\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{M\\\\sphinxhyphen{}x  M\\\\sphinxhyphen{}s}}"""\n    ), (\'verify\', \':kbd:`-`\',\n    \'<p><kbd class="kbd docutils literal notranslate">-</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{\\\\sphinxhyphen{}}}"""\n    ), (\'verify\', \':kbd:`Caps Lock`\',\n    \'<p><kbd class="kbd docutils literal notranslate">Caps Lock</kbd></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxkeyboard{\\\\sphinxupquote{Caps Lock}}"""),\n    (\'verify_re\', \':option:`--with-option`\',\n    \'<p><code( class="xref std std-option docutils literal notranslate")?><span class="pre">--with-option</span></code></p>$\'\n    ,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxcode{\\\\\\\\sphinxupquote{\\\\\\\\sphinxhyphen{}\\\\\\\\sphinxhyphen{}with\\\\\\\\sphinxhyphen{}option}}$\'\n    ), (\'verify\', \'"John"\', \'<p>“John”</p>\',\n    """\\\\sphinxAtStartPar\n“John”"""), (\'verify\', \'``"John"``\',\n    \'<p><code class="docutils literal notranslate"><span class="pre">&quot;John&quot;</span></code></p>\'\n    , """\\\\sphinxAtStartPar\n\\\\sphinxcode{\\\\sphinxupquote{"John"}}"""), (\n    \'verify\', \':manpage:`mp(1)`\', \'<p><em class="manpage">mp(1)</em></p>\',\n    """\\\\sphinxAtStartPar\n\\\\sphinxstyleliteralemphasis{\\\\sphinxupquote{mp(1)}}"""\n    ), (\'verify\', \'Γ\\\\\\\\∞$\', None,\n    """\\\\sphinxAtStartPar\nΓ\\\\textbackslash{}\\\\(\\\\infty\\\\)\\\\$"""), (\'verify\',\n    \'::\\n\\n @Γ\\\\∞${}\', None,\n    """\\\\begin{sphinxVerbatim}[commandchars=\\\\\\\\\\\\{\\\\}]\n@Γ\\\\PYGZbs{}\\\\(\\\\infty\\\\)\\\\PYGZdl{}\\\\PYGZob{}\\\\PYGZcb{}\n\\\\end{sphinxVerbatim}"""\n    ), (\'verify_re\', \'`test <https://www.google.com/~me/>`_\', None,\n    \'\\\\\\\\sphinxAtStartPar\\\\n\\\\\\\\sphinxhref{https://www.google.com/~me/}{test}.*\'\n    ), (\'verify\', """term\n    description""",\n    \'<dl class="docutils">\\n<dt>term</dt><dd>description</dd>\\n</dl>\', None\n    ), (\'verify\', """term : class1 : class2\n    description""",\n    """<dl class="docutils">\n<dt>term<span class="classifier">class1</span><span class="classifier">class2</span></dt><dd>description</dd>\n</dl>"""\n    , None), (\'verify\',\n    """.. glossary::\n\n   term1\n   term2\n       description""",\n    """<dl class="glossary docutils">\n<dt id="term-term1">term1<a class="headerlink" href="#term-term1" title="Permalink to this term">¶</a></dt><dt id="term-term2">term2<a class="headerlink" href="#term-term2" title="Permalink to this term">¶</a></dt><dd>description</dd>\n</dl>"""\n    , None)])', False, 'import pytest\n'), ((392, 1, 399, 2), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(392, 25, 392, 64): '"""type,rst,html_expected,latex_expected"""', (392, 66, 399, 1): "[('verify', '4 backslashes \\\\\\\\\\\\\\\\', '<p>4 backslashes \\\\\\\\</p>', None)]"}, {}), "('type,rst,html_expected,latex_expected', [('verify',\n    '4 backslashes \\\\\\\\\\\\\\\\', '<p>4 backslashes \\\\\\\\</p>', None)])", False, 'import pytest\n'), ((400, 1, 401, 64), 'pytest.mark.skipif', 'pytest.mark.skipif', (), '', False, 'import pytest\n'), ((407, 1, 407, 62), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((408, 1, 418, 2), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(408, 25, 408, 64): '"""type,rst,html_expected,latex_expected"""', (408, 66, 418, 1): '[(\'verify\', \'::\\n\\n @Γ\\\\∞${}\', None,\n    """\\\\begin{sphinxVerbatim}[commandchars=\\\\\\\\\\\\{\\\\}]\n@Γ\\\\PYGZbs{}∞\\\\PYGZdl{}\\\\PYGZob{}\\\\PYGZcb{}\n\\\\end{sphinxVerbatim}"""\n    )]'}, {}), '(\'type,rst,html_expected,latex_expected\', [(\'verify\',\n    \'::\\n\\n @Γ\\\\∞${}\', None,\n    """\\\\begin{sphinxVerbatim}[commandchars=\\\\\\\\\\\\{\\\\}]\n@Γ\\\\PYGZbs{}∞\\\\PYGZdl{}\\\\PYGZob{}\\\\PYGZcb{}\n\\\\end{sphinxVerbatim}"""\n    )])', False, 'import pytest\n'), ((517, 1, 517, 47), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((541, 1, 541, 54), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((550, 1, 551, 59), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((559, 1, 559, 60), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((577, 1, 577, 53), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((597, 1, 598, 63), 'pytest.mark.sphinx', 'pytest.mark.sphinx', (), '', False, 'import pytest\n'), ((31, 4, 31, 20), 'sphinx.util.texescape.init', 'texescape.init', ({}, {}), '()', False, 'from sphinx.util import docutils, texescape\n'), ((32, 16, 33, 56), 'docutils.frontend.OptionParser', 'frontend.OptionParser', (), '', False, 'from docutils import frontend, nodes, utils\n'), ((40, 21, 40, 49), 'sphinx.util.docutils.sphinx_domains', 'sphinx_domains', ({(40, 36, 40, 48): 'settings.env'}, {}), '(settings.env)', False, 'from sphinx.util.docutils import sphinx_domains\n'), ((60, 11, 60, 64), 'sphinx.testing.util.Struct', 'Struct', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((429, 4, 431, 68), 'sphinx.testing.util.assert_node', 'assert_node', ({(429, 16, 429, 26): 'doctree[0]', (429, 28, 431, 67): "[nodes.paragraph, nodes.literal, ('a', [nodes.emphasis, 'b'], 'c')]"}, {}), "(doctree[0], [nodes.paragraph, nodes.literal, ('a', [nodes.\n    emphasis, 'b'], 'c')])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((435, 4, 437, 69), 'sphinx.testing.util.assert_node', 'assert_node', ({(435, 16, 435, 26): 'doctree[0]', (435, 28, 437, 68): "[nodes.paragraph, nodes.literal, ('a', [nodes.emphasis, '{b'], '}c')]"}, {}), "(doctree[0], [nodes.paragraph, nodes.literal, ('a', [nodes.\n    emphasis, '{b'], '}c')])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((442, 4, 442, 69), 'sphinx.testing.util.assert_node', 'assert_node', ({(442, 16, 442, 26): 'doctree[0]', (442, 28, 442, 68): "[nodes.paragraph, nodes.literal, 'a{bc']"}, {}), "(doctree[0], [nodes.paragraph, nodes.literal, 'a{bc'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((447, 4, 447, 70), 'sphinx.testing.util.assert_node', 'assert_node', ({(447, 16, 447, 26): 'doctree[0]', (447, 28, 447, 69): "[nodes.paragraph, nodes.literal, 'a{b}c']"}, {}), "(doctree[0], [nodes.paragraph, nodes.literal, 'a{b}c'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((452, 4, 452, 78), 'sphinx.testing.util.assert_node', 'assert_node', ({(452, 16, 452, 26): 'doctree[0]', (452, 28, 452, 77): "[nodes.paragraph, nodes.literal, 'code   sample']"}, {}), "(doctree[0], [nodes.paragraph, nodes.literal, 'code   sample'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((459, 4, 460, 58), 'sphinx.testing.util.assert_node', 'assert_node', ({(459, 16, 459, 26): 'doctree[0]', (459, 28, 460, 57): "[nodes.paragraph, addnodes.download_reference, nodes.literal, 'sphinx.rst']"}, {}), "(doctree[0], [nodes.paragraph, addnodes.download_reference,\n    nodes.literal, 'sphinx.rst'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((461, 4, 462, 73), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((463, 4, 463, 63), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((468, 4, 469, 56), 'sphinx.testing.util.assert_node', 'assert_node', ({(468, 16, 468, 26): 'doctree[0]', (468, 28, 469, 55): "[nodes.paragraph, addnodes.download_reference, nodes.literal, 'reftitle']"}, {}), "(doctree[0], [nodes.paragraph, addnodes.download_reference,\n    nodes.literal, 'reftitle'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((470, 4, 471, 72), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((472, 4, 472, 63), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((476, 11, 476, 21), 'sphinx.roles.XRefRole', 'XRefRole', ({}, {}), '()', False, 'from sphinx.roles import XRefRole\n'), ((481, 4, 481, 76), 'sphinx.testing.util.assert_node', 'assert_node', ({(481, 16, 481, 27): 'doctrees[0]', (481, 29, 481, 75): "[addnodes.pending_xref, nodes.literal, 'text']"}, {}), "(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((482, 4, 483, 49), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((488, 4, 488, 77), 'sphinx.testing.util.assert_node', 'assert_node', ({(488, 16, 488, 27): 'doctrees[0]', (488, 29, 488, 76): "[addnodes.pending_xref, nodes.literal, 'title']"}, {}), "(doctrees[0], [addnodes.pending_xref, nodes.literal, 'title'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((489, 4, 490, 48), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((494, 4, 494, 63), 'sphinx.testing.util.assert_node', 'assert_node', ({(494, 16, 494, 27): 'doctrees[0]', (494, 29, 494, 62): "[nodes.literal, 'title <target>']"}, {}), "(doctrees[0], [nodes.literal, 'title <target>'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((498, 4, 498, 76), 'sphinx.testing.util.assert_node', 'assert_node', ({(498, 16, 498, 27): 'doctrees[0]', (498, 29, 498, 75): "[addnodes.pending_xref, nodes.literal, 'text']"}, {}), "(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((499, 4, 500, 49), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((503, 11, 503, 36), 'sphinx.roles.XRefRole', 'XRefRole', (), '', False, 'from sphinx.roles import XRefRole\n'), ((505, 4, 505, 78), 'sphinx.testing.util.assert_node', 'assert_node', ({(505, 16, 505, 27): 'doctrees[0]', (505, 29, 505, 77): "[addnodes.pending_xref, nodes.literal, 'text()']"}, {}), "(doctrees[0], [addnodes.pending_xref, nodes.literal, 'text()'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((506, 4, 507, 49), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((510, 11, 510, 35), 'sphinx.roles.XRefRole', 'XRefRole', (), '', False, 'from sphinx.roles import XRefRole\n'), ((512, 4, 512, 76), 'sphinx.testing.util.assert_node', 'assert_node', ({(512, 16, 512, 27): 'doctrees[0]', (512, 29, 512, 75): "[addnodes.pending_xref, nodes.literal, 'TEXT']"}, {}), "(doctrees[0], [addnodes.pending_xref, nodes.literal, 'TEXT'])", False, 'from sphinx.testing.util import Struct, assert_node\n'), ((513, 4, 514, 49), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((524, 4, 524, 40), 'sphinx.testing.util.assert_node', 'assert_node', ({(524, 16, 524, 22): 'rst[0]', (524, 24, 524, 39): 'nodes.paragraph'}, {}), '(rst[0], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((525, 4, 525, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(525, 16, 525, 25): 'rst[0][0]', (525, 27, 525, 41): 'nodes.emphasis'}, {}), '(rst[0][0], nodes.emphasis)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((526, 4, 526, 41), 'sphinx.testing.util.assert_node', 'assert_node', ({(526, 16, 526, 28): 'rst[0][0][0]', (526, 30, 526, 40): 'nodes.Text'}, {}), '(rst[0][0][0], nodes.Text)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((530, 4, 530, 39), 'sphinx.testing.util.assert_node', 'assert_node', ({(530, 16, 530, 23): 'rst[-1]', (530, 25, 530, 38): 'nodes.section'}, {}), '(rst[-1], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((531, 4, 531, 45), 'sphinx.testing.util.assert_node', 'assert_node', ({(531, 16, 531, 27): 'rst[-1][-1]', (531, 29, 531, 44): 'nodes.paragraph'}, {}), '(rst[-1][-1], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((532, 4, 532, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(532, 16, 532, 30): 'rst[-1][-1][0]', (532, 32, 532, 46): 'nodes.emphasis'}, {}), '(rst[-1][-1][0], nodes.emphasis)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((533, 4, 533, 46), 'sphinx.testing.util.assert_node', 'assert_node', ({(533, 16, 533, 33): 'rst[-1][-1][0][0]', (533, 35, 533, 45): 'nodes.Text'}, {}), '(rst[-1][-1][0][0], nodes.Text)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((545, 4, 545, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(545, 16, 545, 26): 'doctree[0]', (545, 28, 545, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((547, 4, 547, 52), 'sphinx.testing.util.assert_node', 'assert_node', ({(547, 16, 547, 29): 'doctree[0][1]', (547, 31, 547, 51): 'nodes.system_message'}, {}), '(doctree[0][1], nodes.system_message)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((555, 4, 555, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(555, 16, 555, 26): 'doctree[0]', (555, 28, 555, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((563, 4, 563, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(563, 16, 563, 26): 'doctree[0]', (563, 28, 563, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((567, 4, 567, 49), 'sphinx.testing.util.assert_node', 'assert_node', ({(567, 16, 567, 29): 'doctree[0][2]', (567, 31, 567, 48): 'nodes.bullet_list'}, {}), '(doctree[0][2], nodes.bullet_list)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((568, 4, 568, 64), 'sphinx.testing.util.assert_node', 'assert_node', ({(568, 16, 568, 35): 'doctree[0][2][0][0]', (568, 37, 568, 63): 'addnodes.compact_paragraph'}, {}), '(doctree[0][2][0][0], addnodes.compact_paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((572, 4, 572, 49), 'sphinx.testing.util.assert_node', 'assert_node', ({(572, 16, 572, 29): 'doctree[0][4]', (572, 31, 572, 48): 'nodes.bullet_list'}, {}), '(doctree[0][4], nodes.bullet_list)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((573, 4, 573, 53), 'sphinx.testing.util.assert_node', 'assert_node', ({(573, 16, 573, 35): 'doctree[0][4][0][0]', (573, 37, 573, 52): 'nodes.paragraph'}, {}), '(doctree[0][4][0][0], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((583, 4, 583, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(583, 16, 583, 26): 'doctree[0]', (583, 28, 583, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((584, 4, 584, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(584, 16, 584, 29): 'doctree[0][1]', (584, 31, 584, 46): 'nodes.paragraph'}, {}), '(doctree[0][1], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((585, 4, 585, 49), 'sphinx.testing.util.assert_node', 'assert_node', ({(585, 16, 585, 32): 'doctree[0][1][0]', (585, 34, 585, 48): 'addnodes.index'}, {}), '(doctree[0][1][0], addnodes.index)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((586, 4, 586, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(586, 16, 586, 32): 'doctree[0][1][1]', (586, 34, 586, 46): 'nodes.target'}, {}), '(doctree[0][1][1], nodes.target)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((587, 4, 587, 67), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((591, 4, 591, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(591, 16, 591, 26): 'doctree[0]', (591, 28, 591, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((592, 4, 592, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(592, 16, 592, 29): 'doctree[0][1]', (592, 31, 592, 46): 'nodes.paragraph'}, {}), '(doctree[0][1], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((593, 4, 593, 56), 'sphinx.testing.util.assert_node', 'assert_node', ({(593, 16, 593, 32): 'doctree[0][1][0]', (593, 34, 593, 55): 'nodes.title_reference'}, {}), '(doctree[0][1][0], nodes.title_reference)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((594, 4, 594, 45), 'sphinx.testing.util.assert_node', 'assert_node', ({(594, 16, 594, 32): 'doctree[0][1][1]', (594, 34, 594, 44): 'nodes.Text'}, {}), '(doctree[0][1][1], nodes.Text)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((604, 4, 604, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(604, 16, 604, 26): 'doctree[0]', (604, 28, 604, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((605, 4, 605, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(605, 16, 605, 29): 'doctree[0][1]', (605, 31, 605, 46): 'nodes.paragraph'}, {}), '(doctree[0][1], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((606, 4, 606, 49), 'sphinx.testing.util.assert_node', 'assert_node', ({(606, 16, 606, 32): 'doctree[0][1][0]', (606, 34, 606, 48): 'addnodes.index'}, {}), '(doctree[0][1][0], addnodes.index)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((607, 4, 607, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(607, 16, 607, 32): 'doctree[0][1][1]', (607, 34, 607, 46): 'nodes.target'}, {}), '(doctree[0][1][1], nodes.target)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((608, 4, 608, 67), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((612, 4, 612, 42), 'sphinx.testing.util.assert_node', 'assert_node', ({(612, 16, 612, 26): 'doctree[0]', (612, 28, 612, 41): 'nodes.section'}, {}), '(doctree[0], nodes.section)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((613, 4, 613, 47), 'sphinx.testing.util.assert_node', 'assert_node', ({(613, 16, 613, 29): 'doctree[0][1]', (613, 31, 613, 46): 'nodes.paragraph'}, {}), '(doctree[0][1], nodes.paragraph)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((614, 4, 614, 69), 'sphinx.testing.util.assert_node', 'assert_node', (), '', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((615, 4, 615, 45), 'sphinx.testing.util.assert_node', 'assert_node', ({(615, 16, 615, 32): 'doctree[0][1][1]', (615, 34, 615, 44): 'nodes.Text'}, {}), '(doctree[0][1][1], nodes.Text)', False, 'from sphinx.testing.util import Struct, assert_node\n'), ((49, 19, 49, 60), 'docutils.utils.new_document', 'utils.new_document', ({(49, 38, 49, 49): '"""test data"""', (49, 51, 49, 59): 'settings'}, {}), "('test data', settings)", False, 'from docutils import frontend, nodes, utils\n'), ((67, 17, 67, 28), 'docutils.parsers.rst.Parser', 'RstParser', ({}, {}), '()', True, 'from docutils.parsers.rst import Parser as RstParser\n'), ((102, 15, 102, 55), 're.match', 're.match', ({(102, 24, 102, 37): 'html_expected', (102, 39, 102, 54): 'html_translated'}, {}), '(html_expected, html_translated)', False, 'import re\n'), ((110, 22, 110, 39), 'sphinx.builders.latex.LaTeXBuilder', 'LaTeXBuilder', ({(110, 35, 110, 38): 'app'}, {}), '(app)', False, 'from sphinx.builders.latex import LaTeXBuilder\n'), ((118, 15, 118, 57), 're.match', 're.match', ({(118, 24, 118, 38): 'latex_expected', (118, 40, 118, 56): 'latex_translated'}, {}), '(latex_expected, latex_translated)', False, 'import re\n'), ((69, 8, 69, 51), 'sphinx.transforms.SphinxSmartQuotes', 'SphinxSmartQuotes', (), '', False, 'from sphinx.transforms import SphinxSmartQuotes\n'), ((98, 8, 98, 35), 'sphinx.builders.html.transforms.KeyboardTransform', 'KeyboardTransform', ({(98, 26, 98, 34): 'document'}, {}), '(document)', False, 'from sphinx.builders.html.transforms import KeyboardTransform\n'), ((136, 32, 136, 56), 're.escape', 're.escape', ({(136, 42, 136, 55): 'html_expected'}, {}), '(html_expected)', False, 'import re\n'), ((138, 33, 138, 58), 're.escape', 're.escape', ({(138, 43, 138, 57): 'latex_expected'}, {}), '(latex_expected)', False, 'import re\n')]