Beispiel #1
0
def test_xlsx_table_creation_from_html_table_with_merged_cells() -> None:
    with read_from_test_dir("table_with_merged_cells.html") as f:
        html_table = f.read()
        actual_wb = render(html_table)
        actual_wb_values = get_wb_values(actual_wb)

    expected_wb = load_workbook(
        get_test_file_path("table_with_merged_cells.xlsx"))
    expected_wb_values = get_wb_values(expected_wb)

    assert actual_wb_values == expected_wb_values
def test_xlsx_report_creation() -> None:
    default_style = Style(
        alignment=Alignment(vertical="center", wrap_text=True),
        font=Font(name="Times New Roman", sz=10),
    )

    with read_from_test_dir("report.html") as f:
        html = f.read()
        wb = render(html, default_style)
        wb.save("actual_report.xlsx")
        actual_values = get_wb_values(wb)

    expected_wb = load_workbook(get_test_file_path("report.xlsx"))
    expected_values = get_wb_values(expected_wb)
    assert actual_values == expected_values
Beispiel #3
0
def test_xlsx_table_creation_from_html_table() -> None:
    with read_from_test_dir("table.html") as f:
        html_table = f.read()

    wb = render(html_table)
    assert get_wb_values(wb) == [(1, 2), (3, 4)]