fix: Lint fixes of core and repositories tests
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user