Пример #1
0
def test_Ul():
    element = Ul('data1')
    element.append('data2')
    with open('file11.html', 'w') as file1fh:
        element.render(file1fh)
    with open('file11.html', 'r') as filefh:
        rendered = filefh.read()
    assert '<ul>\n'+element.indent+'data1\n'+element.indent+'data2\n'+'</ul>\n' == rendered  # noqa: E501
def test_step7():
    li = Li('something')
    ul = Ul('something')
    h = H(2, 'something')
    assert li.tag == 'li'
    assert ul.tag == 'ul'
    assert h.tag == 'h2'
    assert h.content == ['something']

    f = StringIO()
    ul = Ul(Li('something'))
    ul.render(f)
    assert f.getvalue() == ('<ul>\n    <li>\n        something\n    </li>\n'
                            '</ul>\n')

    f = StringIO()
    h.render(f)
    assert f.getvalue() == ('<h2>something</h2>\n')
Пример #3
0
def test_ul():
    test = Ul('an unordered list tag')
    f = StringIO()
    test.render(f)
    assert f.getvalue() == '<ul>\n    an unordered list tag\n</ul>\n'