Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Add test for missing SQLite ANN coverage

davidmezzettie30e8edbcc15
diff --git a/test/python/testann/testdense.py b/test/python/testann/testdense.py
index 08f4d090..b30f514a 100644
--- a/test/python/testann/testdense.py
+++ b/test/python/testann/testdense.py
@@ -576,6 +576,31 @@ class TestDense(unittest.TestCase):
self.assertEqual(model.count(), expected)
+ @unittest.skipIf(platform.system() == "Darwin", "SQLite extensions not supported on macOS")
+ @unittest.skipIf(os.name == "nt", "SQLite copy skipped on Windows due to file locking")
+ def testSQLiteSaveExistingPath(self):
+ """
+ Test saving a SQLite index to an existing path and overwriting the existing database
+ """
+
+ # Test saving to a new path
+ model = self.backend("sqlite")
+ expected = model.count() - 1
+
+ # Test save variations
+ index = os.path.join(tempfile.gettempdir(), "ann.sqlite.existing")
+
+ # Save new
+ model.save(index)
+
+ # Delete id
+ model.delete([0])
+
+ # Save to same path
+ model.save(index)
+
+ self.assertEqual(model.count(), expected)
+
@unittest.skipIf(platform.system() == "Darwin", "SQLite extensions not supported on macOS")
def testSQLiteSaveNewPath(self):
"""
@@ -608,6 +633,7 @@ class TestDense(unittest.TestCase):
self.assertEqual(len(model.search(np.random.rand(1, 240).astype(np.float32), 10)[0]), 10)
model.close()
+ @unittest.skipIf(platform.system() == "Darwin", "SQLite extensions not supported on macOS")
def testSQLiteQuantizeDisabled(self):
"""
Test that quantize: false disables SQLite storage quantization