From 61d154920d158767dc2b29bf9239f74d0dcdc751 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Wed, 3 Feb 2021 15:17:05 +0100 Subject: Allow to get a sorted list of all entries --- tests/test_collection.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_collection.py') diff --git a/tests/test_collection.py b/tests/test_collection.py index 4c95c2b..1e37589 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -391,6 +391,18 @@ class testComplexCollection(unittest.TestCase): self.assertEqual(matches[2].data['order'], 'charlie') self.assertEqual(matches[3].data['order'], 'zucchini') + def test_search_all_documents_default_sort(self): + self.collection.start_search('*') + res = self.collection.get_search_results() + matches = list(res) + self.assertEqual(len(matches), 9) + for i in range(5): + self.assertEqual(matches[i].data['order'], None) + self.assertEqual(matches[5].data['order'], 'alpha') + self.assertEqual(matches[6].data['order'], 'charlie') + self.assertEqual(matches[7].data['order'], 'delta') + self.assertEqual(matches[8].data['order'], 'zucchini') + class testCollectionWithErrors(unittest.TestCase): def setUp(self): -- cgit v1.2.3