Creating a budget overview from a SuperX export.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
1.5 KiB

import pytest
@pytest.fixture
def example_file(example_root):
return example_root / "Verbrauchsmittel-Toto-2020.xlsx"
@pytest.fixture
def example_workbook(example_file):
import openpyxl
yield openpyxl.open(example_file)
@pytest.mark.parametrize(
"input,expected",
[
("a", False),
("", True),
(" ", True),
(" a ", False),
(None, True),
(0, False),
(2.2, False),
],
)
def test_is_empty_excel_value(input, expected):
from superx_budget.helpers import is_empty_excel_value
result = is_empty_excel_value(input)
assert result == expected
@pytest.mark.parametrize(
"input,expected",
[
("a", "a"),
("", ""),
(" ", ""),
(" a ", "a"),
(None, None),
(1, 1),
(2.2, 2.2),
],
)
def test_strip_excel_value(input, expected):
from superx_budget.helpers import strip_excel_value
result = strip_excel_value(input)
assert result == expected
def test_get_sheet_of_file_first(example_file):
from superx_budget.helpers import get_sheet_of_file
sheet = get_sheet_of_file(example_file) # sheet=None
first_row = next(sheet.values)
first_cell = first_row[0]
assert first_cell.strip() == "Nr."
def test_get_sheet_of_file_named(example_file):
from superx_budget.helpers import get_sheet_of_file
sheet = get_sheet_of_file(example_file, sheet="Safeguard I")
first_row = next(sheet.values)
first_cell = first_row[0]
assert first_cell == 1