style(tests): hoist test_api_tags grounding imports to module level (ruff I001)
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Successful in 37s
CI / integration (push) Successful in 3m43s

CI ruff flagged the in-function import block; move them to the top mirroring
test_ml_suggestions.py's import line, which ruff already accepts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
2026-07-06 13:24:55 -04:00
parent 9bb4211722
commit 2638cf1a35
+4 -10
View File
@@ -1,4 +1,8 @@
import pytest
from sqlalchemy import select
from backend.app.models import ImageRecord, ImageRegion, MLSettings, TagHead, TagKind
from backend.app.services.tag_service import TagService
pytestmark = pytest.mark.integration
@@ -104,13 +108,6 @@ async def test_applied_tag_grounding_returns_winning_region(client, db):
# Hovering an applied chip fetches the crop that best explains the tag. Here
# the whole-image vector is orthogonal to the head but a concept crop aligns,
# so the crop wins the max-over-bag → grounding is that region's box.
from sqlalchemy import select
from backend.app.models import (
ImageRecord, ImageRegion, MLSettings, TagHead, TagKind,
)
from backend.app.services.tag_service import TagService
ver = (await db.execute(
select(MLSettings).where(MLSettings.id == 1)
)).scalar_one().embedder_model_version
@@ -148,9 +145,6 @@ async def test_applied_tag_grounding_returns_winning_region(client, db):
async def test_applied_tag_grounding_no_head(client, db):
# A tag with no head can't be localized → has_head False, grounding null; the
# chip shows no overlay. Validates the response contract the frontend reads.
from backend.app.models import ImageRecord, TagKind
from backend.app.services.tag_service import TagService
img = ImageRecord(
path="/images/grchip2.jpg", sha256="gd" * 32, size_bytes=1,
mime="image/jpeg", width=1, height=1, origin="imported_filesystem",