def test_markup():
    assert Markup(html.a(name='value')(html.b(first='one'), 'Text', html.c())) == '<a name="value"><b first="one" />Text<c></c></a>'
    assert Markup(html.p(html.comment('Comment'))) == '<p><!--Comment--></p>'
    assert Markup(html.p(html.safe('<strong>&nbsp;Text&nbsp;</strong>'))) == '<p><strong>&nbsp;Text&nbsp;</strong></p>'
    assert Markup(html.safe('<strong>&nbsp;Text&nbsp;</strong>')) == '<strong>&nbsp;Text&nbsp;</strong>'

    assert rn(html.p(Markup('<strong>&nbsp;Text&nbsp;</strong>'))) == '<p><strong>&nbsp;Text&nbsp;</strong></p>'
    assert rn(html.p(Markup('&nbsp; '), Markup('<strong>One</strong>'))) == '<p>&nbsp; <strong>One</strong></p>'
    assert render(html.p(Markup('&nbsp; '), Markup('<strong>One</strong>'))) == u'<p>\n  &nbsp; \n  <strong>One</strong>\n</p>\n'
예제 #2
0
def test_markup():
    assert Markup(html.a(name='value')(
        html.b(first='one'), 'Text',
        html.c())) == '<a name="value"><b first="one" />Text<c></c></a>'
    assert Markup(html.p(html.comment('Comment'))) == '<p><!--Comment--></p>'
    assert Markup(html.p(html.safe('<strong>&nbsp;Text&nbsp;</strong>'))
                  ) == '<p><strong>&nbsp;Text&nbsp;</strong></p>'
    assert Markup(html.safe('<strong>&nbsp;Text&nbsp;</strong>')
                  ) == '<strong>&nbsp;Text&nbsp;</strong>'

    assert rn(html.p(Markup('<strong>&nbsp;Text&nbsp;</strong>'))
              ) == '<p><strong>&nbsp;Text&nbsp;</strong></p>'
    assert rn(html.p(Markup('&nbsp; '), Markup(
        '<strong>One</strong>'))) == '<p>&nbsp; <strong>One</strong></p>'
    assert render(html.p(Markup('&nbsp; '), Markup('<strong>One</strong>'))
                  ) == u'<p>\n  &nbsp; \n  <strong>One</strong>\n</p>\n'
def test_many_child_indenting():
    assert render(html.a(name='value')(html.b(first='one'), 'Text', html.c())) == '<a name="value">\n  <b first="one" />\n  Text\n  <c></c>\n</a>\n'
def test_nesting():
    assert rn(html.a(name='value')(html.b('Text'), html.c(html.d, html.e()))) == '<a name="value"><b>Text</b><c><d /><e></e></c></a>'
def test_many_children():
    assert rn(html.a(name='value')(html.b(first='one'), 'Text', html.c())) == '<a name="value"><b first="one" />Text<c></c></a>'
def test_iteratable_render():
    assert rn([html.a, 'Text', html.b()]) == '<a />Text<b></b>'
    assert rn(html.c([html.a, 'Text', html.b()])) == '<c><a />Text<b></b></c>'
예제 #7
0
def test_many_child_indenting():
    assert render(html.a(name='value')(html.b(first='one'), 'Text', html.c(
    ))) == '<a name="value">\n  <b first="one" />\n  Text\n  <c></c>\n</a>\n'
예제 #8
0
def test_nesting():
    assert rn(html.a(name='value')(html.b('Text'), html.c(
        html.d,
        html.e()))) == '<a name="value"><b>Text</b><c><d /><e></e></c></a>'
예제 #9
0
def test_many_children():
    assert rn(html.a(name='value')(
        html.b(first='one'), 'Text',
        html.c())) == '<a name="value"><b first="one" />Text<c></c></a>'
예제 #10
0
def test_iteratable_render():
    assert rn([html.a, 'Text', html.b()]) == '<a />Text<b></b>'
    assert rn(html.c([html.a, 'Text', html.b()])) == '<c><a />Text<b></b></c>'