From cfdbaaba06a39937836477faf7c6e3a68e7af06b Mon Sep 17 00:00:00 2001 From: oqyude Date: Mon, 16 Nov 2026 02:27:24 +0300 Subject: [PATCH] =?UTF-8?q?CI:=20ruff=20format=20--check=20=E2=80=94=20?= =?UTF-8?q?=D1=82=D1=80=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D1=8B=20=D0=BA=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D1=83=20ruff=200.17.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Гейт `ruff format --check .` в .github/workflows/ci.yml был красным на dev до слияния веток: application/forecast.py, tests/test_excel_authoring.py, tests/test_forecast.py — разница только в раскладке выражений по строкам (ruff 0.17.2 переносит длинные однострочные списки в одну строку при line-length = 120). Изменение чисто форматное: 354 теста зелёные до и после, ruff check чистый. --- application/forecast.py | 8 ++------ tests/test_excel_authoring.py | 8 ++------ tests/test_forecast.py | 18 +++--------------- 3 files changed, 7 insertions(+), 27 deletions(-) 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")