fix: Lint fixes of core and repositories tests
All checks were successful
Backend CI / lint (push) Successful in 9m26s
Backend CI / test (push) Successful in 4m24s

This commit is contained in:
JSC
2025-08-01 09:17:20 +02:00
parent 389cfe2d6a
commit dc29915fbc
8 changed files with 135 additions and 88 deletions

View File

@@ -1,14 +1,19 @@
"""Tests for sound repository."""
# ruff: noqa: ARG002, PLR2004
from collections.abc import AsyncGenerator
import pytest
import pytest_asyncio
from sqlalchemy.exc import IntegrityError
from sqlmodel.ext.asyncio.session import AsyncSession
from app.models.sound import Sound
from app.repositories.sound import SoundRepository
# Constants
MIN_POPULAR_SOUNDS = 3
class TestSoundRepository:
"""Test sound repository operations."""
@@ -306,7 +311,7 @@ class TestSoundRepository:
# Get popular sounds
popular_sounds = await sound_repository.get_popular_sounds(limit=10)
assert len(popular_sounds) >= 3
assert len(popular_sounds) >= MIN_POPULAR_SOUNDS
# Should be ordered by play_count desc
assert popular_sounds[0].play_count >= popular_sounds[1].play_count
# The highest play count sound should be first
@@ -372,5 +377,5 @@ class TestSoundRepository:
}
# Should fail due to unique constraint on hash
with pytest.raises(Exception): # SQLAlchemy IntegrityError or similar
with pytest.raises(IntegrityError, match="UNIQUE constraint failed"):
await sound_repository.create(duplicate_sound_data)