diff --git a/tests/test_api_tags.py b/tests/test_api_tags.py index 31e3558..00f3b83 100644 --- a/tests/test_api_tags.py +++ b/tests/test_api_tags.py @@ -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",