Exemplo n.º 1
0
def test_cfussy_filter():
    assert_output('cfussy', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c")
    try:
        assert_output('cfussy', C_HELLO_WORLD, "HELLO, world\n", ext=".c")
        assert False, 'should raise NonzeroExit'
    except dexy.exceptions.NonzeroExit:
        assert True
Exemplo n.º 2
0
def test_cfussy_filter():
    assert_output('cfussy', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c")
    with wrap() as wrapper:
        wrapper.debug = False
        doc = Doc("hello.c|cfussy", contents=C_HELLO_WORLD, wrapper=wrapper)
        wrapper.run_docs(doc)
        assert wrapper.state == 'error'
Exemplo n.º 3
0
def test_cfussy_filter():
    assert_output('cfussy', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c")
    with wrap() as wrapper:
        wrapper.debug = False
        doc = Doc("hello.c|cfussy",
                contents=C_HELLO_WORLD,
                wrapper=wrapper)
        wrapper.run_docs(doc)
        assert wrapper.state == 'error'
def test_rest_to_html():
    expected = """\
<ul class="simple">
<li>a bullet point using &quot;*&quot;<ul>
<li>a sub-list using &quot;-&quot;<ul>
<li>yet another sub-list</li>
</ul>
</li>
<li>another item</li>
</ul>
</li>
</ul>
"""

    assert_output('rst', RST, expected)
def test_rest_to_html():
    expected = """\
<ul class="simple">
<li>a bullet point using &quot;*&quot;<ul>
<li>a sub-list using &quot;-&quot;<ul>
<li>yet another sub-list</li>
</ul>
</li>
<li>another item</li>
</ul>
</li>
</ul>
"""

    assert_output('rstbody', RST, expected)
Exemplo n.º 6
0
def test_irb():
    assert_output("example.rb|irb", "1+1", ">> 1+1\n=> 2")

    config = {"." : { "@example.rb|irb" : {"irb": {"ext" : ".json", "meta" : True}, "contents" : "1+1"}}}
    for doc in run_dexy(config):
        doc.run()

        artifact = doc.last_artifact
        assert artifact.output() == ">> 1+1\n=> 2"

        kv_artifact = artifact.inputs().values()[0]
        kv_artifact.setup_kv_storage()
        assert kv_artifact['1:files:example.rb'] == "1+1"
        assert kv_artifact['1:html-output']
        assert kv_artifact['1:latex-output']
        assert kv_artifact['1:output'] == ">> 1+1\n=> 2"
Exemplo n.º 7
0
def test_process_method_manual_write():
    assert_output("processmanual", "hello", "Dexy processed the text 'hello'")
Exemplo n.º 8
0
def test_lua():
    assert_output('lua', 'print ("Hello")', "Hello\n")
Exemplo n.º 9
0
def test_c_filter():
    assert_output('gcc', C_HELLO_WORLD, "HELLO, world\n", ext=".c")
    assert_output('gcc', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c")
Exemplo n.º 10
0
def test_rintbatch():
    assert_output("example.R|rintbatch", "1+1", "> 1+1\n[1] 2\n> \n")
Exemplo n.º 11
0
def test_head_filter():
    assert_output("head", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
Exemplo n.º 12
0
def test_python():
    assert_output('py', 'print 1+1', "2" + os.linesep)
Exemplo n.º 13
0
def test_bash():
    assert_output('bash', 'echo "hello"', "hello\n")
Exemplo n.º 14
0
def test_php():
    php = inspect.cleandoc("""<?php
    echo(1+1);
    ?>""")
    assert_output('php', php, "2")
Exemplo n.º 15
0
def test_node():
    assert_output("nodejs", "console.log('hello');", "hello\n")
Exemplo n.º 16
0
def test_strings():
    assert_output('strings', "hello\bmore", "hello\nmore\n")
Exemplo n.º 17
0
def test_redclothl():
    expected = "hello \\textbf{bold}" + os.linesep + os.linesep
    assert_output("redclothl", "hello *bold*", expected)
Exemplo n.º 18
0
def test_redcloth():
    expected = "<p>hello <strong>bold</strong></p>" + os.linesep
    assert_output("redcloth", "hello *bold*", expected)
Exemplo n.º 19
0
def test_r_int_batch():
    assert_output('rintbatch', '1+1', "> 1+1\n[1] 2\n> \n")
Exemplo n.º 20
0
def test_rhino():
    assert_output('rhino', "print(6*7)", "42\n")
Exemplo n.º 21
0
def test_scalac():
    assert_output('scala',
                  SCALA,
                  "Hello, world!\n",
                  ext=".scala",
                  basename="HelloWorld")
Exemplo n.º 22
0
def test_process_method_with_dict():
    assert_output("processwithdict", "hello",
                  {'1': "Dexy processed the text 'hello'"})
Exemplo n.º 23
0
def test_ppjson_filter():
    assert_output(
            "ppjson",
            '{"foo" :123, "bar" :456}',
            """{\n    "bar": 456, \n    "foo": 123\n}"""
            )
Exemplo n.º 24
0
def test_phantomjs_stdout_filter():
    assert_output('phantomjs', PHANTOM_JS, "Hello, world!\n")
Exemplo n.º 25
0
def test_lyx():
    assert_output("lyxjinja", "dexy:foo.py|idio:multiply",
                  "<< d['foo.py|idio']['multiply'] >>", ".tex")
Exemplo n.º 26
0
def test_pyg4rst():
    o = {}
    o['1'] = ".. code:: python\n\n  print 'hello'"
    assert_output("pyg4rst", "print 'hello'", o, ext=".py")
Exemplo n.º 27
0
def test_r_batch():
    assert_output('rout', 'print(1+1)', "[1] 2\n")
Exemplo n.º 28
0
def test_jython_filter():
    assert_output('jython', "print 1+1", "2\n")
Exemplo n.º 29
0
def test_clang_filter():
    assert_output('clang', C_HELLO_WORLD, "HELLO, world\n", ext=".c")
Exemplo n.º 30
0
def test_clang_filter():
    assert_output('clang', C_HELLO_WORLD, "HELLO, world\n", ext=".c")
Exemplo n.º 31
0
def test_lua():
    assert_output('lua', 'print ("Hello")', "Hello\n")
Exemplo n.º 32
0
def test_ruby():
    assert_output('rb', 'puts "hello"', "hello\n")
Exemplo n.º 33
0
def test_jruby_filter():
    assert_output('jruby', "puts 1+1", "2\n")
Exemplo n.º 34
0
def test_head_filter():
    assert_output("head", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
Exemplo n.º 35
0
def test_cpp_filter():
    assert_output('cpp', CPP_HELLO_WORLD, "Hello, world!", ext=".cpp")
Exemplo n.º 36
0
def test_lines_filter():
    expected = OrderedDict()
    expected['1'] = "line one"
    expected['2'] = "line two"

    assert_output("lines", "line one\nline two", expected)
Exemplo n.º 37
0
def test_c_filter():
    assert_output('gcc', C_HELLO_WORLD, "HELLO, world\n", ext=".c")
    assert_output('gcc', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c")
Exemplo n.º 38
0
def test_ppjson_filter():
    assert_output(
            "ppjson",
            '{"foo" :123, "bar" :456}',
            """{\n    "bar": 456, \n    "foo": 123\n}"""
            )
Exemplo n.º 39
0
def test_r_batch():
    assert_output('rout', 'print(1+1)', "[1] 2\n")
Exemplo n.º 40
0
def test_start_space_filter():
    assert_output("startspace", "abc\ndef", " abc\n def")
Exemplo n.º 41
0
def test_pandoc_filter():
    assert_output("pandoc", "hello", "<p>hello</p>\n", ext=".md")
Exemplo n.º 42
0
def test_join_filter():
    contents = OrderedDict()
    contents['1'] = "section one"
    contents['2'] = "section two"

    assert_output("join", contents, "section one\nsection two")
Exemplo n.º 43
0
def test_join_filter():
    contents = json.loads("""[{},
    {"name" : "1", "contents" : "section one" },
    {"name" : "2", "contents" : "section two" }
    ]""")
    assert_output("join", contents, "section one\nsection two")
Exemplo n.º 44
0
def test_process_text_to_dict_filter():
    assert_output("processtexttodict", "hello", {'1': "Dexy processed the text 'hello'"})
Exemplo n.º 45
0
def test_lines_filter():
    expected = {}
    expected['1'] = "line one"
    expected['2'] = "line two"
    assert_output("lines", "line one\nline two", expected)
Exemplo n.º 46
0
def text_process_dict():
    assert_output("processdict", {'1': 'hello'}, {'1': "Dexy processed the text 'hello'"})
Exemplo n.º 47
0
def test_start_space_filter():
    o = {}
    o['1'] = " abc\n def"
    assert_output("startspace", "abc\ndef", o)
Exemplo n.º 48
0
def test_process_method():
    assert_output("process", "hello", "Dexy processed the text 'hello'")
Exemplo n.º 49
0
def test_scalac():
    assert_output('scala', SCALA, "Hello, world!\n", ext=".scala", basename="HelloWorld")
Exemplo n.º 50
0
def test_process_method_manual_write():
    assert_output("processmanual", "hello", "Dexy processed the text 'hello'")
Exemplo n.º 51
0
def test_rout():
    assert_output("example.R|rout", "1+1", "[1] 2\n")
Exemplo n.º 52
0
def test_process_method_with_dict():
    assert_output("processwithdict", "hello", {'1' : "Dexy processed the text 'hello'"})
Exemplo n.º 53
0
def test_pandoc_filter():
    assert_output("pandoc", "hello", "<p>hello</p>\n", ext=".md")
Exemplo n.º 54
0
def test_process_text_filter():
    assert_output("processtext", "hello", "Dexy processed the text 'hello'")
Exemplo n.º 55
0
def test_r_int_batch():
    assert_output('rintbatch', '1+1', "> 1+1\n[1] 2\n> \n")
Exemplo n.º 56
0
def test_cpp_filter():
    assert_output('cpp', CPP_HELLO_WORLD, "Hello, world!", ext=".cpp")