예제 #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")])
        ])])
예제 #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))
예제 #4
0
def force_writes_are_never_empty():
    assert_equal([html.force_write], html.strip_empty([html.force_write]))
예제 #5
0
def self_closing_elements_are_never_empty():
    assert_equal([html.element("br")], html.strip_empty([html.element("br")]))
예제 #6
0
def elements_with_only_empty_children_are_stripped():
    assert_equal([], html.strip_empty([html.element("p", {},
                                                    [html.text("")])]))
예제 #7
0
def elements_with_no_children_are_stripped():
    assert_equal([], html.strip_empty([html.element("p")]))
예제 #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")]))
예제 #15
0
def empty_text_nodes_are_stripped():
    assert_equal([], html.strip_empty([html.text("")]))
예제 #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("")]))