diff --git a/superx_budget/budget.py b/superx_budget/budget.py index 7ac322f..091c5ba 100644 --- a/superx_budget/budget.py +++ b/superx_budget/budget.py @@ -16,7 +16,7 @@ EXPECTED_TABLE_HEADERS = [ "Rest", ] -EXCEL_LINES_TO_IGNORE = {"stand:", "stand"} +EXCEL_LINES_TO_IGNORE = {"stand"} NUM_EXPECTED_HEADERS = len(EXPECTED_TABLE_HEADERS) @@ -56,7 +56,7 @@ def _skip_some_lines(rows): continue if isinstance(first_cell, str): value = first_cell.strip().lower() - if value in EXCEL_LINES_TO_IGNORE: + if any(value.startswith(item) for item in EXCEL_LINES_TO_IGNORE): continue yield xl_row diff --git a/tests/test_budget_parser.py b/tests/test_budget_parser.py index 93a5feb..1e95aa4 100644 --- a/tests/test_budget_parser.py +++ b/tests/test_budget_parser.py @@ -21,6 +21,7 @@ def test_skip_empty_lines(): ExcelRow(3, [""]), ExcelRow(4, ["two"]), ExcelRow(5, [""]), + ExcelRow(5, ["sTanD:"]), ] result = _skip_some_lines(rows) @@ -54,12 +55,12 @@ def test_parse_budget_data(budget_example_sheet): result = parse_budget_data(budget_example_sheet) first, last = result[0], result[-1] - assert len(result) == 20 + assert len(result) == 19 # the line starting with "Stand" is filtered out assert first.row == 3 assert first.number == 1 assert first.project_name == "Safeguard IV" assert first.rest == "=F3-G3" - assert last.row == 61 + assert last.row == 57 def test_parse_budget_file(budget_example_file): @@ -68,7 +69,7 @@ def test_parse_budget_file(budget_example_file): result = parse_budget_file(budget_example_file) first = result[0] - assert len(result) == 20 + assert len(result) == 19 # the line starting with "Stand" is filtered out assert first.row == 3 assert first.number == 1 assert first.project_name == "Safeguard IV" diff --git a/tests/test_overview.py b/tests/test_overview.py index 4ae1a5b..89df024 100644 --- a/tests/test_overview.py +++ b/tests/test_overview.py @@ -86,7 +86,7 @@ def test_create_overview_map(budget_example_file): budget_data = parse_budget_file(budget_example_file) result = _create_overview_map(budget_data) - assert len(result) == 20 + assert len(result) == 19 # the line starting with "Stand" is filtered out assert "1083013701" in result for key, value in result.items(): assert key == str(value.project)