"""Embedder unit tests. The SigLIP model is a multi-GB download not present
in CI, so these test only the import-safety contract and the singleton.
Real embedding runs in the local integration suite.
"""

from backend.app.services.ml.embedder import (
    EMBED_DIM,
    MODEL_VERSION,
    Embedder,
    get_embedder,
)


def test_embed_dim_matches_schema():
    # image_record.siglip_embedding and tag_reference_embedding.embedding
    # are both Vector(1152). This must stay in sync.
    assert EMBED_DIM == 1152


def test_model_version_default():
    assert MODEL_VERSION == "siglip-so400m-patch14-384"


def test_get_embedder_singleton():
    assert get_embedder() is get_embedder()


def test_not_loaded_until_called():
    e = Embedder()
    assert e._model is None  # not loaded until .load()
