style: привести код к ruff format (line-length 120)
Обнаружено на шаге 0: `ruff format --check .` НЕ был чистым в baseline (24 файла расходились с форматом ruff). `ruff check .` был чистым. Изменение только косметическое (переносы, пустая строка после docstring модуля, склейка вызовов в пределах line-length=120 из [tool.ruff]); поведение не меняется — pytest 81/81 зелёные, `ruff check .` — без ошибок. Нужно, чтобы `ruff format --check .` стал рабочим гейтом (D13 CI).
This commit is contained in:
1 parent
9b53b25a91
commit
af01efc41a
24 files changed
+219
-160
No files matched your search
+16
-8
@@ -25,24 +25,32 @@ def sample_model() -> FinancialModel:
|
||||
],
|
||||
transactions=[
|
||||
Transaction(
|
||||
date="2026-01-01", account=str(acc_id),
|
||||
category="income", amount=3000.0,
|
||||
date="2026-01-01",
|
||||
account=str(acc_id),
|
||||
category="income",
|
||||
amount=3000.0,
|
||||
description="Зарплата",
|
||||
),
|
||||
Transaction(
|
||||
date="2026-01-05", account=str(acc_id),
|
||||
category="rent", amount=-1200.0,
|
||||
date="2026-01-05",
|
||||
account=str(acc_id),
|
||||
category="rent",
|
||||
amount=-1200.0,
|
||||
description="Аренда",
|
||||
),
|
||||
],
|
||||
recurring=[
|
||||
RecurringCashflow(
|
||||
start_date="2026-01-01", frequency="monthly",
|
||||
amount=500.0, category="income",
|
||||
start_date="2026-01-01",
|
||||
frequency="monthly",
|
||||
amount=500.0,
|
||||
category="income",
|
||||
),
|
||||
RecurringCashflow(
|
||||
start_date="2026-01-01", frequency="monthly",
|
||||
amount=-200.0, category="subscription",
|
||||
start_date="2026-01-01",
|
||||
frequency="monthly",
|
||||
amount=-200.0,
|
||||
category="subscription",
|
||||
),
|
||||
],
|
||||
assets=[
|
||||
|
||||
+57
-28
@@ -86,13 +86,21 @@ class TestCli:
|
||||
runner.invoke(app, ["init"])
|
||||
runner.invoke(app, ["config", "account-add", "--name", "Счёт", "--balance", "0"])
|
||||
|
||||
add = runner.invoke(app, [
|
||||
"config", "transaction-add",
|
||||
"--account", "Счёт",
|
||||
"--amount", "5000",
|
||||
"--category", "income",
|
||||
"--description", "Зарплата",
|
||||
])
|
||||
add = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"config",
|
||||
"transaction-add",
|
||||
"--account",
|
||||
"Счёт",
|
||||
"--amount",
|
||||
"5000",
|
||||
"--category",
|
||||
"income",
|
||||
"--description",
|
||||
"Зарплата",
|
||||
],
|
||||
)
|
||||
assert add.exit_code == 0
|
||||
assert "доход" in add.stdout
|
||||
|
||||
@@ -103,12 +111,19 @@ class TestCli:
|
||||
_cleanup()
|
||||
runner.invoke(app, ["init"])
|
||||
|
||||
add = runner.invoke(app, [
|
||||
"config", "asset-add",
|
||||
"--name", "Квартира",
|
||||
"--value", "5000000",
|
||||
"--growth", "5",
|
||||
])
|
||||
add = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"config",
|
||||
"asset-add",
|
||||
"--name",
|
||||
"Квартира",
|
||||
"--value",
|
||||
"5000000",
|
||||
"--growth",
|
||||
"5",
|
||||
],
|
||||
)
|
||||
assert add.exit_code == 0
|
||||
assert "Квартира" in add.stdout
|
||||
|
||||
@@ -119,13 +134,21 @@ class TestCli:
|
||||
_cleanup()
|
||||
runner.invoke(app, ["init"])
|
||||
|
||||
add = runner.invoke(app, [
|
||||
"config", "liability-add",
|
||||
"--name", "Кредит",
|
||||
"--balance", "100000",
|
||||
"--interest", "10",
|
||||
"--payment", "5000",
|
||||
])
|
||||
add = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"config",
|
||||
"liability-add",
|
||||
"--name",
|
||||
"Кредит",
|
||||
"--balance",
|
||||
"100000",
|
||||
"--interest",
|
||||
"10",
|
||||
"--payment",
|
||||
"5000",
|
||||
],
|
||||
)
|
||||
assert add.exit_code == 0
|
||||
assert "Кредит" in add.stdout
|
||||
|
||||
@@ -133,12 +156,19 @@ class TestCli:
|
||||
_cleanup()
|
||||
runner.invoke(app, ["init"])
|
||||
|
||||
add = runner.invoke(app, [
|
||||
"config", "recurring-add",
|
||||
"--amount", "-500",
|
||||
"--category", "аренда",
|
||||
"--frequency", "monthly",
|
||||
])
|
||||
add = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"config",
|
||||
"recurring-add",
|
||||
"--amount",
|
||||
"-500",
|
||||
"--category",
|
||||
"аренда",
|
||||
"--frequency",
|
||||
"monthly",
|
||||
],
|
||||
)
|
||||
assert add.exit_code == 0
|
||||
|
||||
lst = runner.invoke(app, ["config", "recurring-list"])
|
||||
@@ -160,8 +190,7 @@ class TestCli:
|
||||
runner.invoke(app, ["init"])
|
||||
acc_args = ["config", "account-add", "--name", "Основной", "--balance", "50000"]
|
||||
runner.invoke(app, acc_args)
|
||||
asset_args = ["config", "asset-add", "--name", "Акции",
|
||||
"--value", "100000", "--growth", "8.0"]
|
||||
asset_args = ["config", "asset-add", "--name", "Акции", "--value", "100000", "--growth", "8.0"]
|
||||
runner.invoke(app, asset_args)
|
||||
|
||||
result = runner.invoke(app, ["info"])
|
||||
|
||||
@@ -6,6 +6,7 @@ CLI (D3 — удаление мёртвых typer.Typer(), D25 — разбие
|
||||
на пакет): если набор изменился, поведение CLI изменилось без
|
||||
согласования — тест обязан упасть.
|
||||
"""
|
||||
|
||||
import typer
|
||||
from typer.main import get_command
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ class TestFinancialModel:
|
||||
|
||||
def test_base_currency_backward_compat(self, tmp_path: Path):
|
||||
import json
|
||||
|
||||
p = tmp_path / "legacy.json"
|
||||
with open(p, "w") as f:
|
||||
json.dump({"accounts": []}, f)
|
||||
|
||||
@@ -29,6 +29,7 @@ class TestJsonFileRepository:
|
||||
p = tmp_path / "v.json"
|
||||
repo.save(model, p)
|
||||
import json
|
||||
|
||||
with open(p) as f:
|
||||
data = json.load(f)
|
||||
assert data["version"] == 1
|
||||
@@ -46,9 +47,7 @@ class TestJsonFileRepository:
|
||||
|
||||
def test_decimal_preserved(self, tmp_path: Path):
|
||||
repo = JsonFileRepository()
|
||||
model = FinancialModel(
|
||||
assets=[Asset(name="Stocks", value=Decimal("12345.67"), growth_rate=Decimal("8.5"))]
|
||||
)
|
||||
model = FinancialModel(assets=[Asset(name="Stocks", value=Decimal("12345.67"), growth_rate=Decimal("8.5"))])
|
||||
p = tmp_path / "decimal.json"
|
||||
repo.save(model, p)
|
||||
loaded = repo.load(p)
|
||||
|
||||
Reference in new issue
Block a user