Пример #1
0
def test_css_parsing():
    html_element = copy(CSS_PROFILES['strict']['div'])
    CssParse.attr_style('padding_left: 8px; display: block', html_element)
    assert html_element.padding_inline == 1
    assert html_element.display == Display.block

    CssParse.attr_style('margin_before: 8em; display: inline', html_element)
    assert html_element.margin_before == 8
    assert html_element.display == Display.inline
Пример #2
0
def test_style_unit_parsing():
    html_element = HtmlElement()
    CssParse.attr_style(
        "margin-top:2.666666667em;margin-bottom: 2.666666667em", html_element)
    assert html_element.margin_before == 3
    assert html_element.margin_after == 3