Esempio n. 1
0
def empty_children_are_removed():
    assert_equal(
        html.strip_empty([
            html.element("ul", {}, [
                html.element("li", {}, [html.text("")]),
                html.element("li", {}, [html.text("H")]),
            ])
        ]),
        [html.element("ul", {}, [html.element("li", {}, [html.text("H")])])])
def empty_children_are_removed():
    assert_equal(
        html.strip_empty([html.element("ul", {}, [
            html.element("li", {}, [html.text("")]),
            html.element("li", {}, [html.text("H")]),
        ])]),
        
        [html.element("ul", {}, [
            html.element("li", {}, [html.text("H")])
        ])])
Esempio n. 3
0
def table_nodes_are_reserved():
    elements = [
        html.element('table', {}, [
            html.element('tr', {'rowspan': 2}, [
                html.element('td', {}, [html.text('H')]),
            ]),
            html.element('tr', []),
        ])
    ]
    assert_equal(elements, html.strip_empty(elements))
Esempio n. 4
0
def force_writes_are_never_empty():
    assert_equal([html.force_write], html.strip_empty([html.force_write]))
Esempio n. 5
0
def self_closing_elements_are_never_empty():
    assert_equal([html.element("br")], html.strip_empty([html.element("br")]))
Esempio n. 6
0
def elements_with_only_empty_children_are_stripped():
    assert_equal([], html.strip_empty([html.element("p", {},
                                                    [html.text("")])]))
Esempio n. 7
0
def elements_with_no_children_are_stripped():
    assert_equal([], html.strip_empty([html.element("p")]))
Esempio n. 8
0
def elements_with_non_empty_children_are_not_stripped():
    assert_equal([html.element("p", {}, [html.text("H")])],
                 html.strip_empty([html.element("p", {}, [html.text("H")])]))
def elements_with_non_empty_children_are_not_stripped():
    assert_equal(
        [html.element("p", {}, [html.text("H")])],
        html.strip_empty([html.element("p", {}, [html.text("H")])]))
def force_writes_are_never_empty():
    assert_equal(
        [html.force_write],
        html.strip_empty([html.force_write]))
def text_nodes_with_text_are_not_stripped():
    assert_equal(
        [html.text("H")],
        html.strip_empty([html.text("H")]))
def self_closing_elements_are_never_empty():
    assert_equal(
        [html.element("br")],
        html.strip_empty([html.element("br")]))
def elements_with_only_empty_children_are_stripped():
    assert_equal(
        [],
        html.strip_empty([html.element("p", {}, [html.text("")])]))
def elements_with_no_children_are_stripped():
    assert_equal(
        [],
        html.strip_empty([html.element("p")]))
Esempio n. 15
0
def empty_text_nodes_are_stripped():
    assert_equal([], html.strip_empty([html.text("")]))
Esempio n. 16
0
def text_nodes_with_text_are_not_stripped():
    assert_equal([html.text("H")], html.strip_empty([html.text("H")]))
def empty_text_nodes_are_stripped():
    assert_equal(
        [],
        html.strip_empty([html.text("")]))