Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Update test

davidmezzetti79b4109aee87
diff --git a/test/python/testdatabase/testembeddings.py b/test/python/testdatabase/testembeddings.py
index 5f0044b1..05409c44 100644
--- a/test/python/testdatabase/testembeddings.py
+++ b/test/python/testdatabase/testembeddings.py
@@ -6,6 +6,8 @@ import os
import tempfile
import unittest
+from pathlib import Path
+
from txtai.embeddings import Embeddings
from txtai.database import Database, SQLException
@@ -131,6 +133,10 @@ class TestEmbeddings(unittest.TestCase):
# Save to a different location
indexupdate = os.path.join(tempfile.gettempdir(), "embeddings.update")
+
+ # Create existing file to test file save conflicts
+ Path.touch(os.path.join(indexupdate, "documents"))
+
self.embeddings.save(indexupdate)
# Save to same location
@@ -148,11 +154,6 @@ class TestEmbeddings(unittest.TestCase):
result = self.embeddings.search("feel good story", 1)[0]
self.assertEqual(result["text"], self.data[4])
- # Save back to same location
- self.embeddings.save(index)
- result = self.embeddings.search("feel good story", 1)[0]
- self.assertEqual(result["text"], self.data[4])
-
def testNotImplemented(self):
"""
Tests exceptions for non-implemented methods