Exemple #1
0
def test_parse_several_paragraph_norm():
    BGB_27_DIV = html.fromstring(HTML_BGB_27)
    result = extract_from_div(BGB_27_DIV)

    paragraphs = result["paragraphs"]

    assert 3 == len(paragraphs)
Exemple #2
0
def test_parse_norm():
    BGB_13_DIV = html.fromstring(HTML_BGB_13)
    result = extract_from_div(BGB_13_DIV)
    assert isinstance(result, dict)
    assert result.keys() == {"type", "norm", "title", "paragraphs"}
    assert result["type"] == "norm"
    assert result["norm"] == "§ 13"
    assert result["title"] == "Verbraucher"
    assert len(result["paragraphs"]) == 1
Exemple #3
0
def test_parse_subsub_paragraph_norm():
    BGB_207_DIV = html.fromstring(HTML_BGB_207)
    result = extract_from_div(BGB_207_DIV)

    lens = [0, 2, 0, 0, 0]
    subs = result["paragraphs"][0]["sub"]

    assert 5 == len(subs)
    assert lens == [len(sub["sub"]) for sub in subs]
Exemple #4
0
def test_very_complex_norm():
    BGB_308_DIV = html.fromstring(HTML_BGB_308)
    result = extract_from_div(BGB_308_DIV)

    subs = result["paragraphs"][0]["sub"]

    assert 10 == len(subs)
    assert 2 == len(subs[6]["sub"])
    assert 2 == len(subs[8]["sub"])
    assert 2 == len(subs[9]["sub"])
Exemple #5
0
def test_parse_sub_paragraph_norm():
    BGB_81_DIV = html.fromstring(HTML_BGB_81)
    result = extract_from_div(BGB_81_DIV)

    paragraphs = result["paragraphs"]

    assert 2 == len(paragraphs)

    first_paragraph = paragraphs[0]
    assert len(first_paragraph["sub"]) == 5
    assert len(first_paragraph["text"]) > 42