def test_br_in_p():
    p = P("here is a small paragraph of text")
    p.append(Br())
    p.append("And here is some more text after a line break")

    file_contents = render_result(p).split('\n')
    print(file_contents)
    assert file_contents[2].strip() == "<br />"
def test_step5():
    hr = Hr()
    f = StringIO()
    hr.render(f)
    assert f.getvalue() == ('<hr />\n')

    br = Br()
    f = StringIO()
    br.render(f)
    assert f.getvalue() == ('<br />\n')

    with pytest.raises(TypeError):
        hr = Hr('anything')

    with pytest.raises(TypeError):
        br = Br('anything')
def test_content_in_br():
    with pytest.raises(TypeError):
        br = Br("some content")
def test_br():
    br = Br("")
    file_contents = render_result(br)
    print(file_contents)
    assert file_contents == "<br />"
Beispiel #5
0
def test_self_closing_tag_string():
    # Check that error is raised if content is used to init
    atts = {"id": "fred", "class": "special", "size": "12px"}
    with pytest.raises(TypeError):
        p = Br("Now Leasing", **atts)
Beispiel #6
0
def test_br():
    test = Br()
    f = StringIO()
    test.render(f)
    assert f.getvalue() == '<br />\n'
def test_br():
    br = Br()
    results = render_element(br)
    print(results)
    assert results.startswith('<br>')