aboutsummaryrefslogtreecommitdiff
path: root/tests/test_collection.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r--tests/test_collection.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 6a6e5e3..4c95c2b 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -289,9 +289,9 @@ class testComplexCollection(unittest.TestCase):
self.collection.settings['name'],
"Fully featured lesana collection",
)
- self.assertEqual(len(self.collection.settings['fields']), 9)
+ self.assertEqual(len(self.collection.settings['fields']), 10)
self.assertIsNotNone(self.collection.stemmer)
- self.assertEqual(len(self.collection.indexed_fields), 7)
+ self.assertEqual(len(self.collection.indexed_fields), 8)
def test_index(self):
indexed = self.collection.update_cache()
@@ -379,6 +379,18 @@ class testComplexCollection(unittest.TestCase):
self.assertEqual(matches[2].data['amount'], 10)
self.assertEqual(matches[3].data['amount'], 2)
+ def test_default_sorted_search(self):
+ # search in ascending order
+ self.collection.start_search('Amount')
+ res = self.collection.get_search_results()
+ matches = list(res)
+ self.assertEqual(len(matches), 4)
+ print([m.data['order'] for m in matches])
+ self.assertEqual(matches[0].data['order'], None)
+ self.assertEqual(matches[1].data['order'], 'alpha')
+ self.assertEqual(matches[2].data['order'], 'charlie')
+ self.assertEqual(matches[3].data['order'], 'zucchini')
+
class testCollectionWithErrors(unittest.TestCase):
def setUp(self):