Skip to content

Commit c1734ce

Browse files
fix(tests): add mypy type assertions for nullable returns
- Add assert is not None before accessing Account attributes - Add type annotation for empty dict in test - Add type ignore for unreachable fixture cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9eb23ad commit c1734ce

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tests/integration/test_db_integration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ async def temp_db():
2424
await init_db(db_path)
2525
yield db_path
2626

27-
# Cleanup
27+
# Cleanup (runs after test completes)
2828
if engine_module._engine:
29-
await engine_module._engine.dispose()
29+
await engine_module._engine.dispose() # type: ignore[unreachable]
3030

3131

3232
@pytest.mark.asyncio
@@ -55,6 +55,7 @@ async def test_full_account_lifecycle(temp_db):
5555
refresh_token="new_refresh",
5656
expires_at=datetime.now(UTC) + timedelta(hours=2),
5757
)
58+
assert updated is not None
5859
assert updated.access_token == "new_access"
5960

6061
# List

tests/unit/db/test_migration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async def test_migrate_skips_existing(setup):
9292

9393
# Verify original data preserved
9494
account = await repo.get("existing")
95+
assert account is not None
9596
assert account.access_token == "db_access" # Not overwritten
9697

9798

@@ -169,7 +170,7 @@ async def test_migrate_empty_accounts(setup):
169170
tmpdir, db_path, json_path = setup
170171

171172
# Create accounts.json with empty accounts
172-
accounts_data = {"accounts": {}}
173+
accounts_data: dict[str, dict[str, dict[str, str]]] = {"accounts": {}}
173174
json_path.write_text(json.dumps(accounts_data))
174175

175176
# Run migration
@@ -227,9 +228,11 @@ async def test_migrate_partial_success(setup):
227228

228229
# Verify both accounts exist with correct data
229230
existing = await repo.get("existing")
231+
assert existing is not None
230232
assert existing.access_token == "db_access" # Not overwritten
231233

232234
new = await repo.get("new-account")
235+
assert new is not None
233236
assert new.access_token == "new_access"
234237

235238

0 commit comments

Comments
 (0)