diff --git a/application/forecast.py b/application/forecast.py index 59c08e7..b984094 100644 --- a/application/forecast.py +++ b/application/forecast.py @@ -210,9 +210,7 @@ class ForecastService: month_expenses[target] += abs(total) # Общие платежи — пропорционально балансам счетов месяца. - provisional = [ - running[i] + month_income[i] - month_expenses[i] for i in range(account_count) - ] + provisional = [running[i] + month_income[i] - month_expenses[i] for i in range(account_count)] for total in shared: for i, share in enumerate(_shares_by_balance(provisional)): portion = total * share @@ -223,9 +221,7 @@ class ForecastService: # Стоимость обязательств — один раз за месяц на модель (D39): # проценты начисляются один раз, и тело кредита гасится один раз. - month_balances = [ - running[i] + month_income[i] - month_expenses[i] for i in range(account_count) - ] + month_balances = [running[i] + month_income[i] - month_expenses[i] for i in range(account_count)] cost = self._liability_cost(liability_balances) for i, share in enumerate(_shares_by_balance(month_balances)): portion = cost * share diff --git a/tests/test_excel_authoring.py b/tests/test_excel_authoring.py index af2db1f..8c8d6ce 100644 --- a/tests/test_excel_authoring.py +++ b/tests/test_excel_authoring.py @@ -82,9 +82,7 @@ class TestTemplate: wb = load_workbook(path) try: ws = wb["Инструкция"] - text = "\n".join( - str(cell.value) for row in ws.iter_rows() for cell in row if cell.value is not None - ) + text = "\n".join(str(cell.value) for row in ws.iter_rows() for cell in row if cell.value is not None) assert "Порядок работы" in text assert "Счёт" in text assert "Периодичность" in text @@ -349,9 +347,7 @@ class TestExportIsEditable: model = FinancialModel( accounts=[Account(name="Доллары", currency="USD", balance=Decimal("100"))], - transactions=[ - Transaction(date="2026-01-01", account="Доллары", amount=Decimal("5"), currency="EUR") - ], + transactions=[Transaction(date="2026-01-01", account="Доллары", amount=Decimal("5"), currency="EUR")], ) path = tmp_path / "currencies.xlsx" ExcelRepository().save(model, path) diff --git a/tests/test_forecast.py b/tests/test_forecast.py index cdbbec6..8e04eb1 100644 --- a/tests/test_forecast.py +++ b/tests/test_forecast.py @@ -590,11 +590,7 @@ class TestMultipleAccounts: Account(name="A", balance=Decimal("1000")), Account(name="B", balance=Decimal("3000")), ], - recurring=[ - RecurringCashflow( - amount=Decimal("1000"), frequency="monthly", start_date="2026-01-01" - ) - ], + recurring=[RecurringCashflow(amount=Decimal("1000"), frequency="monthly", start_date="2026-01-01")], ) rows = ForecastService(model, start_month=self._GRID).forecast_cashflow(months=1) # 1000 — а не 2000: платёж общий, он один на модель. @@ -606,11 +602,7 @@ class TestMultipleAccounts: Account(name="A", balance=Decimal("1000")), Account(name="B", balance=Decimal("3000")), ], - recurring=[ - RecurringCashflow( - amount=Decimal("1000"), frequency="monthly", start_date="2026-01-01" - ) - ], + recurring=[RecurringCashflow(amount=Decimal("1000"), frequency="monthly", start_date="2026-01-01")], ) rows = ForecastService(model, start_month=self._GRID).forecast_cashflow(months=1) # Доли — по балансам: 1000 / 4000 и 3000 / 4000. @@ -623,11 +615,7 @@ class TestMultipleAccounts: Account(name="A", balance=Decimal("1000")), Account(name="B", balance=Decimal("3000")), ], - recurring=[ - RecurringCashflow( - amount=Decimal("-200"), frequency="monthly", start_date="2026-01-01" - ) - ], + recurring=[RecurringCashflow(amount=Decimal("-200"), frequency="monthly", start_date="2026-01-01")], ) rows = ForecastService(model, start_month=self._GRID).forecast_cashflow(months=1) assert sum(r["expenses"] for r in rows) == Decimal("200.00")