mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-03-16 22:20:31 +00:00
Added test of field facets of floats and numbers.
This commit is contained in:
parent
0bea487560
commit
a3ea18207a
2 changed files with 16 additions and 0 deletions
|
|
@ -365,6 +365,18 @@ class BackendFeaturesTestCase(HaystackBackendTestCase, TestCase):
|
|||
self.assertEqual(results['facets']['fields']['sites'],
|
||||
[('1', 1), ('3', 2), ('2', 2), ('4', 1), ('6', 2), ('9', 1)])
|
||||
|
||||
results = self.backend.search(xapian.Query('indexed'),
|
||||
facets=['number'])
|
||||
self.assertEqual(results['hits'], 3)
|
||||
self.assertEqual(results['facets']['fields']['number'],
|
||||
[(5, 1), (10, 1), (15, 1)])
|
||||
|
||||
results = self.backend.search(xapian.Query('indexed'),
|
||||
facets=['float_number'])
|
||||
self.assertEqual(results['hits'], 3)
|
||||
self.assertEqual(results['facets']['fields']['float_number'],
|
||||
[(35.5, 1), (834.0, 1), (972.0, 1)])
|
||||
|
||||
def test_raise_index_error_on_wrong_field(self):
|
||||
"""
|
||||
Regression test for #109.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ from ..tests.test_backend import HaystackBackendTestCase
|
|||
|
||||
|
||||
class XapianSearchQueryTestCase(HaystackBackendTestCase, TestCase):
|
||||
"""
|
||||
Tests the XapianSearchQuery, the class that converts SearchQuerySet queries
|
||||
using the `__` notation to XapianQueries.
|
||||
"""
|
||||
def get_index(self):
|
||||
return MockQueryIndex()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue