This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from openpyxl import load_workbook
|
||||
|
||||
from finance.exporting import build_formula_workbook
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
def test_reconcile_status_guards_non_numeric_difference(workspace):
|
||||
ds, member, *_ = workspace
|
||||
ds.periods = ["2025-08"]
|
||||
ds.save(update_fields=["periods"])
|
||||
output = BytesIO()
|
||||
build_formula_workbook(
|
||||
ds,
|
||||
member,
|
||||
{"start": "2026-08", "end": "2026-08", "comparison": "yoy", "group": "department"},
|
||||
output,
|
||||
)
|
||||
workbook = load_workbook(BytesIO(output.getvalue()), data_only=False)
|
||||
formulas = [
|
||||
row[6].value
|
||||
for row in workbook["对账检查"].iter_rows(min_row=2)
|
||||
if isinstance(row[6].value, str) and row[6].value.startswith("=IF(D")
|
||||
]
|
||||
assert formulas
|
||||
assert all("ISNUMBER(F" in formula for formula in formulas)
|
||||
assert all('"通过"' in formula for formula in formulas)
|
||||
Reference in New Issue
Block a user