Source code for berhoel.odf.test.test_ods

#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Testing accessing ods files.
"""

# Third party libraries.
import pytest

from berhoel.odf.ods import LINKED_CELL, IMDB_HYPERLINK, Ods

__date__ = "2020/05/26 21:49:34 hoel"
__author__ = "Berthold Höllmann"
__copyright__ = "Copyright © 2020 by Berthold Höllmann"
__credits__ = ["Berthold Höllmann"]
__maintainer__ = "Berthold Höllmann"
__email__ = "berhoel@gmail.com"


[docs]@pytest.fixture def ods_sample1(data1): return Ods(data1)
[docs]def test_tables(ods_sample1): assert ods_sample1.tables is not None assert len(ods_sample1.tables) == 2
[docs]@pytest.fixture def tables(ods_sample1): return ods_sample1.tables
[docs]def test_table_names(tables): assert tables[0].name == "Tabelle1" assert tables[1].name == "Tabelle2"
[docs]def test_table_rows(tables): assert len(tables[0].rows) == 9 assert len(tables[1].rows) == 4
[docs]def test_table_hidden(tables): assert not tables[0].hidden assert tables[1].hidden
[docs]@pytest.fixture def rows0(tables): return tables[0].rows
[docs]@pytest.fixture def rows1(tables): return tables[1].rows
[docs]def test_rows0_1(rows0): for i, row in enumerate(rows0): assert len(row.cells) == 4, f"row: {i}"
[docs]def test_rows1_1(rows1): for i, row in enumerate(rows1): assert len(row.cells) == 3, f"row: {i}"
# Local Variables: # mode: python # compile-command: "poetry run tox" # time-stamp-pattern: "30/__date__ = \"%:y/%02m/%02d %02H:%02M:%02S %u\"" # End: