예제 #1
0
from mau.parsers.main_parser import MainParser
from mau.visitors.markua_visitor import MarkuaVisitor

from tests.helpers import (
    init_parser_factory,
    ast_test_factory,
    init_ast_factory,
    dedent,
    listasdict,
    visitlist_factory,
)

init_parser = init_parser_factory(MainParser)
init_ast = init_ast_factory(MainParser)

_test = ast_test_factory(MainParser, MarkuaVisitor)

visitlist = visitlist_factory(MarkuaVisitor)


def test_text():
    v = MarkuaVisitor()

    output = v.visit({
        "type": "text",
        "value": "This is text",
    })

    assert output == "This is text"

예제 #2
0
from mau.visitors.html_visitor import HTMLVisitor

from tests.helpers import (
    dedent,
    init_parser_factory,
    init_ast_factory,
    ast_test_factory,
    remove_indentation,
    visitlist_factory,
)

init_parser = init_parser_factory(MainParser)

init_ast = init_ast_factory(MainParser)

_test = ast_test_factory(MainParser, HTMLVisitor)

visitlist = visitlist_factory(HTMLVisitor)


def test_text():
    v = HTMLVisitor()

    output = v.visit(
        {
            "type": "text",
            "value": "This is text",
        }
    )

    assert output == "This is text"
예제 #3
0
from mau.parsers.main_parser import MainParser
from mau.visitors.asciidoctor_visitor import AsciidoctorVisitor

from tests.helpers import (
    init_parser_factory,
    ast_test_factory,
    init_ast_factory,
    dedent,
    listasdict,
    visitlist_factory,
)

init_parser = init_parser_factory(MainParser)
init_ast = init_ast_factory(MainParser)

_test = ast_test_factory(MainParser, AsciidoctorVisitor)

visitlist = visitlist_factory(AsciidoctorVisitor)


def test_text():
    v = AsciidoctorVisitor()

    output = v.visit({
        "type": "text",
        "value": "This is text",
    })

    assert output == "This is text"