fix: remove numpy dependency from test_memory_embeddings
Use MagicMock to simulate .tolist() instead of importing numpy, which is not in the test dependencies. Fixes broken unit test on main.
This commit is contained in:
@@ -112,10 +112,10 @@ class TestEmbedText:
|
||||
assert len(vec) == 128 # hash fallback dimension
|
||||
|
||||
def test_uses_model_when_available(self):
|
||||
import numpy as np
|
||||
|
||||
mock_encoding = MagicMock()
|
||||
mock_encoding.tolist.return_value = [0.1, 0.2, 0.3]
|
||||
mock_model = MagicMock()
|
||||
mock_model.encode.return_value = np.array([0.1, 0.2, 0.3])
|
||||
mock_model.encode.return_value = mock_encoding
|
||||
emb.EMBEDDING_MODEL = mock_model
|
||||
|
||||
result = embed_text("test")
|
||||
|
||||
Reference in New Issue
Block a user