Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

fixing ruff on tests

Tássio Noronha56c123a20e60
diff --git a/backend/tests/test_accounts_api_coverage.py b/backend/tests/test_accounts_api_coverage.py
index b10bb32f..f03bfc81 100644
--- a/backend/tests/test_accounts_api_coverage.py
+++ b/backend/tests/test_accounts_api_coverage.py
@@ -4,8 +4,6 @@ Exercises list filters, get/create/update/delete, close/reopen, summary,
balance-history and bills endpoints, plus 404/400 error branches and the
non-primary-currency conversion path.
"""
-import uuid
-from decimal import Decimal
import pytest
from httpx import AsyncClient
diff --git a/backend/tests/test_group_service_coverage.py b/backend/tests/test_group_service_coverage.py
index 3ad649a0..c4e8eb65 100644
--- a/backend/tests/test_group_service_coverage.py
+++ b/backend/tests/test_group_service_coverage.py
@@ -12,7 +12,6 @@ import bcrypt as _bcrypt
import pytest
from sqlalchemy.ext.asyncio import AsyncSession
-from app.models.account import Account
from app.models.transaction import Transaction
from app.models.transaction_split import TransactionSplit
from app.models.user import User
diff --git a/backend/tests/test_report_service_coverage.py b/backend/tests/test_report_service_coverage.py
index 3e585361..10d2afc7 100644
--- a/backend/tests/test_report_service_coverage.py
+++ b/backend/tests/test_report_service_coverage.py
@@ -26,7 +26,6 @@ from app.models.bank_connection import BankConnection
from app.models.category import Category
from app.models.recurring_transaction import RecurringTransaction
from app.models.transaction import Transaction
-from app.models.user import User
from app.services.report_service import (
_get_baseline_projection,
_net_worth_at,
diff --git a/backend/tests/test_transaction_service_coverage.py b/backend/tests/test_transaction_service_coverage.py
index b357012e..47049104 100644
--- a/backend/tests/test_transaction_service_coverage.py
+++ b/backend/tests/test_transaction_service_coverage.py
@@ -7,7 +7,7 @@ assorted edge branches. See test_transaction_service.py for the baseline.
"""
import uuid
-from datetime import date, datetime, timedelta, timezone
+from datetime import date, datetime, timezone
from decimal import Decimal
import pytest
@@ -15,7 +15,6 @@ import pytest_asyncio
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.account import Account
-from app.models.category import Category
from app.models.credit_card_bill import CreditCardBill
from app.models.group import Group, GroupMember
from app.models.transaction import Transaction
@@ -369,11 +368,11 @@ async def test_get_transfer_candidates_ranks_by_proximity(session, test_user, te
type="debit", date=date(2025, 3, 15),
)
# Best candidate: closest date + same amount, opposing type, other account
- close = await _mk_txn(
+ await _mk_txn(
session, test_user, acct2, description="Close", amount=Decimal("100"),
type="credit", date=date(2025, 3, 16),
)
- far = await _mk_txn(
+ await _mk_txn(
session, test_user, acct2, description="Far", amount=Decimal("100"),
type="credit", date=date(2025, 3, 25),
)
@@ -830,12 +829,12 @@ async def test_get_transactions_bill_id_filter(session, test_user, test_workspac
await session.commit()
# Linked to the bill directly.
- linked = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="Linked", amount=Decimal("100"),
date=date(2025, 4, 5), bill_id=bill.id, effective_date=date(2025, 4, 20),
)
# Unlinked manual tx whose date falls inside the window.
- in_window = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="InWindow", amount=Decimal("50"),
date=date(2025, 4, 7), effective_date=date(2025, 4, 7),
)
@@ -863,7 +862,7 @@ async def test_get_transactions_bill_id_no_dates(session, test_user, test_worksp
)
session.add(bill)
await session.commit()
- linked = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="OnlyLinked", amount=Decimal("100"),
date=date(2025, 4, 5), bill_id=bill.id, effective_date=date(2025, 4, 20),
)
@@ -880,11 +879,11 @@ async def test_get_transactions_unbilled_only(session, test_user, test_workspace
session.add(bill)
await session.commit()
- billed = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="AlreadyBilled", amount=Decimal("100"),
date=date(2025, 5, 3), bill_id=bill.id, effective_date=date(2025, 5, 3),
)
- unbilled = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="StillUnbilled", amount=Decimal("40"),
date=date(2025, 5, 4), effective_date=date(2025, 5, 4),
)
@@ -900,7 +899,7 @@ async def test_get_transactions_unbilled_only(session, test_user, test_workspace
async def test_get_transactions_unbilled_only_forward_override(session, test_user, test_workspace, cc_account):
# A tx with a forward-pointing manual override beyond the window edge
# should still surface in the in-progress cycle (issue #162).
- forward = await _mk_txn(
+ await _mk_txn(
session, test_user, cc_account, description="ForwardOverride", amount=Decimal("70"),
date=date(2025, 5, 10), effective_date=date(2025, 7, 20),
effective_bill_date=date(2025, 7, 20),
diff --git a/backend/tests/test_transactions_api_coverage.py b/backend/tests/test_transactions_api_coverage.py
index fea4ea5f..b02eb1e9 100644
--- a/backend/tests/test_transactions_api_coverage.py
+++ b/backend/tests/test_transactions_api_coverage.py
@@ -4,15 +4,12 @@ Covers list filters, export (filtered + selection), get/create/update/delete,
ignore toggle, bulk endpoints, transfer/link/counterpart/candidates, and
error branches (404/400/422).
"""
-import uuid
from datetime import date
-from decimal import Decimal
import pytest
from httpx import AsyncClient
from app.models.account import Account
-from app.models.transaction import Transaction
NONEXISTENT = "00000000-0000-0000-0000-000000000000"
diff --git a/backend/tests/test_workspace_service_coverage.py b/backend/tests/test_workspace_service_coverage.py
index 9498385e..142824f2 100644
--- a/backend/tests/test_workspace_service_coverage.py
+++ b/backend/tests/test_workspace_service_coverage.py
@@ -6,8 +6,6 @@ paths, update_member_role validation, get_workspace_stats, archive_workspace,
and remove_member.
"""
import uuid
-from datetime import date, datetime, timezone
-from decimal import Decimal
import bcrypt as _bcrypt
import pytest
@@ -15,10 +13,8 @@ from fastapi import HTTPException
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
-from app.models.account import Account
-from app.models.transaction import Transaction
from app.models.user import User
-from app.models.workspace import Workspace, WorkspaceMember
+from app.models.workspace import Workspace
from app.services import workspace_service
@@ -189,7 +185,7 @@ async def test_archive_workspace_blocks_last(session: AsyncSession, test_user: U
@pytest.mark.asyncio
async def test_archive_workspace_succeeds_with_other(session: AsyncSession, test_user: User, test_workspace):
- second = await workspace_service.create_workspace(
+ await workspace_service.create_workspace(
session, name="Second", creator=test_user, self_membership=True, seed_defaults=False
)
await session.commit()