コード例 #1
0
def test_render_indent():
    my_stuff = 'indentedstuff'
    el_object = HTML(my_stuff)
    el_object.indent = 5
    with open('test-ind', "w") as out_file:
        el_object.render(out_file)
    with open('test-ind', 'r') as in_file:
        contents = in_file.read()
    assert el_object.indent == 5
コード例 #2
0
def test_render_HTML():
    my_stuff = 'hamma, hamma, hamma'
    el_object = HTML(my_stuff)
    more_stuff = "umma, umma, umma"
    el_object.append(more_stuff)
    with open('testh', 'w') as out_file:
        el_object.render(out_file)
    with open('testh', 'r') as in_file:
        contents = in_file.read()
    assert contents.startswith('<html>')
    assert contents.endswith('</html>')
    assert my_stuff in contents
    assert more_stuff in contents