Пример #1
0
def test_get_section_actually_nothing(empty_html_tree):
    # construct input
    html_tree = empty_html_tree
    doc_div = get_doc_div(html_tree)
    add_section_div(doc_div, 'foo')
    add_section_div(doc_div, 'bar')
    # checking
    for section in XmlExportTestCaseDoc.SECTIONS:
        assert export.get_section(html_tree, section.html_id) is None
Пример #2
0
def test_get_section_drop_header(empty_html_tree):
    # construct input
    html_tree = empty_html_tree
    section_el = add_section_div(get_doc_div(html_tree), "description")
    # just to highlight that we have h2 header as the 1st element in the section
    assert section_el[0].tag == HTML + "h2"
    # run, run
    result_el = export.get_section(html_tree, "description")
    # checking: header should not be there anymore
    assert result_el[0].tag == HTML + "p"
Пример #3
0
def test_get_section_single(empty_html_tree, section):
    # construct input
    html_tree = empty_html_tree
    doc_div = get_doc_div(html_tree)
    add_section_div(doc_div, 'foo')
    section_el = add_section_div(doc_div, section.html_id)
    add_section_div(doc_div, 'bar')
    # run, run
    result_el = export.get_section(html_tree, section.html_id)
    # checking
    assert result_el is not None
    assert result_el == section_el
    other_sections = []
    for other_section in XmlExportTestCaseDoc.SECTIONS:
        if other_section == section:
            continue
        other_sections.append(other_section)
    for section in other_sections:
        assert export.get_section(html_tree, section.html_id) is None
Пример #4
0
def test_get_section_notempty(fulltestcase_html_tree):
    for section in XmlExportTestCaseDoc.SECTIONS:
        assert export.get_section(fulltestcase_html_tree,
                                  section.html_id) is not None
Пример #5
0
def test_get_section_empty(empty_html_tree):
    for section in XmlExportTestCaseDoc.SECTIONS:
        assert export.get_section(empty_html_tree, section.html_id) is None