Ejemplo n.º 1
0
def test_get_first_block_with_inner_inline():
    html_string = """<html>
    <head>
        <title>Test Page</title>
    </head>
    <body>
        <atricle>
            <ul class="BlockParent">
                <li>Test 1</li>
                <li>Test 2</li>
                <li>Test <strong id="SelectMe">Nog 1</strong></li>
            </ul>
        </article>
    </body>
    </html>"""
    mock_url = "https://www.getevents.nl/"
    page = BasePage(html_string, mock_url)
    strong_node = page.css_first("strong#SelectMe")
    block_parent = page.get_first_block(strong_node)
    assert block_parent.attributes["class"] == "BlockParent"
Ejemplo n.º 2
0
def test_get_first_block():
    html_string = """<html>
    <head>
        <title>Test Page</title>
    </head>
    <body>
        <article>
            <ul class="blockParent">
                <li>test1</li>
                <li id="selectMe">test2</li>
                <li>test3</li>
            </ul>
        </article>
    </body>
    </html>"""
    mock_url = "https://www.getevents.nl/"
    page = BasePage(html_string, mock_url)
    li_node = page.css_first("li#selectMe")
    block_parent = page.get_first_block(li_node)
    assert block_parent.attributes["class"] == "blockParent"