e-commerce / backend /tests /conftest.py
VincentA2K's picture
Product Recommendation RestAPI
480e694
raw
history blame contribute delete
494 Bytes
import pytest
from pathlib import Path
import pickle
import numpy as np
@pytest.fixture
def mock_embeddings():
return {
"embeddings": np.random.rand(10, 384),
"search_queries": ["query1", "query2"],
"product_names": ["product1", "product2"]
}
@pytest.fixture
def mock_model_path(tmp_path, mock_embeddings):
model_path = tmp_path / "product_embeddings.pkl"
with open(model_path, "wb") as f:
pickle.dump(mock_embeddings, f)
return model_path