Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Fix test order

davidmezzetti5ddedf07cd48
diff --git a/test/python/testann/testsparse.py b/test/python/testann/testsparse.py
index 12eaa486..be98bf1f 100644
--- a/test/python/testann/testsparse.py
+++ b/test/python/testann/testsparse.py
@@ -90,6 +90,24 @@ class TestSparse(unittest.TestCase):
self.assertLess(len(ann.blocks), 15)
ann.close()
+ def testIVFSparseSortOrder(self):
+ """
+ Test IVFSparse returns results sorted by score descending
+ """
+
+ # Generate test data
+ data = self.generate(50, 30522)
+
+ ann = SparseANNFactory.create({"backend": "ivfsparse"})
+ ann.index(data)
+
+ # Each result list must be ranked by score descending
+ for results in ann.search(data[:5], 10):
+ scores = [score for _, score in results]
+ self.assertEqual(scores, sorted(scores, reverse=True))
+
+ ann.close()
+
def testIVFSparseTopnOverLimit(self):
"""
Test IVFSparse topn when limit exceeds the number of indexed documents
@@ -113,24 +131,6 @@ class TestSparse(unittest.TestCase):
ann.close()
- def testIVFSparseSortOrder(self):
- """
- Test IVFSparse returns results sorted by score descending
- """
-
- # Generate test data
- data = self.generate(50, 30522)
-
- ann = SparseANNFactory.create({"backend": "ivfsparse"})
- ann.index(data)
-
- # Each result list must be ranked by score descending
- for results in ann.search(data[:5], 10):
- scores = [score for _, score in results]
- self.assertEqual(scores, sorted(scores, reverse=True))
-
- ann.close()
-
@patch("sqlalchemy.orm.Query.limit")
def testPGSparse(self, query):
"""