Exemple #1
0
def test_parse():
    soup = sd.cook(sample)

    parse_article_selector = sd.parse("article", "Paragraph of the {}.")

    assert parse_article_selector(soup)[0] == "article"
Exemple #2
0
def test_text():
    soup = sd.cook(sample)

    text_h1_selector = sd.text("h1")

    assert text_h1_selector(soup) == soup.h1.string
Exemple #3
0
def test_html():
    soup = sd.cook(sample)

    html_header_selector = sd.html("header")

    assert html_header_selector(soup) == soup.header
Exemple #4
0
def test_attr():
    soup = sd.cook(sample)

    attr_href_selector = sd.attr("a", "href")

    assert attr_href_selector(soup) == soup.a["href"]
Exemple #5
0
def test_cook_returns_soup():
    soup = sd.cook(sample)

    assert isinstance(soup, BeautifulSoup)