decouple core data from CLI formatting
build / build (push) Successful in 49s
pytest / pytest (push) Successful in 30s

This commit is contained in:
Matteo Rosati
2026-04-29 12:44:28 +02:00
parent 615ab14a1a
commit d1b1238897
12 changed files with 142 additions and 87 deletions
+20 -2
View File
@@ -1,11 +1,29 @@
from __future__ import annotations
import unittest
from unittest.mock import patch
from chromy.embed import embed
class EmbedTest(unittest.TestCase):
def test_embed_function(self) -> None:
self.assertEqual(0, 0)
def test_embed_returns_empty_list_for_empty_chunks(self) -> None:
self.assertEqual(embed([]), [])
def test_embed_pairs_text_with_list_embeddings(self) -> None:
with patch(
"chromy.embed.DefaultEmbeddingFunction",
return_value=lambda chunks: ((1.0, 2.0), (3.0, 4.0)),
):
result = embed(["first", "second"])
self.assertEqual(
result,
[
{"text": "first", "embedding": [1.0, 2.0]},
{"text": "second", "embedding": [3.0, 4.0]},
],
)
if __name__ == "__main__":