コード例 #1
0
def test_render_doc_example():
    section = {
        "type": "example",
        "args": ["intro"],
        "data": "xyz",
    }
    expected = """The annotated hexdump below shows a `"abc" message <abc.html>`__. (The message header has been omitted.)

.. highlight:: text

::

   xyz
"""
    renderer = RendererRST()
    renderer.message = "abc"
    assert renderer.render_doc_example(section) == expected
コード例 #2
0
def test_resolve_link_target():
    renderer = RendererRST()

    tests = [
        [
            "message:abc",
            "abc.html",
        ],
        [
            "intro:message-header",
            "intro.html#message-header",
        ],
        [
            "type:sometype",
            "types/sometype.html",
        ],
    ]

    for test in tests:
        assert renderer.resolve_link_target(test[0]) == test[1]

    renderer.message = "types/one"
    assert renderer.resolve_link_target("type:two") == "two.html"