mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-04-12 11:10:58 +00:00
Changed is not to is when testing for list, tuple. Silly style thing.
This commit is contained in:
parent
4bff8c9376
commit
60e8925280
3 changed files with 13 additions and 8 deletions
|
|
@ -130,6 +130,7 @@ class XapianSearchBackendTestCase(TestCase):
|
|||
{'flag': u'f', 'name': u'david2', 'text': u'indexed!\n2', 'sites': u"['2', '4', '6']", 'pub_date': u'20090223000000', 'value': u'000000000010', 'id': u'tests.xapianmockmodel.2', 'slug': u'http://example.com/2', 'popularity': '\xb4p', 'django_id': u'2', 'django_ct': u'tests.xapianmockmodel'},
|
||||
{'flag': u't', 'name': u'david3', 'text': u'indexed!\n3', 'sites': u"['3', '6', '9']", 'pub_date': u'20090222000000', 'value': u'000000000015', 'id': u'tests.xapianmockmodel.3', 'slug': u'http://example.com/3', 'popularity': '\xcb\x98', 'django_id': u'3', 'django_ct': u'tests.xapianmockmodel'}
|
||||
])
|
||||
import pdb; pdb.set_trace()
|
||||
|
||||
def test_duplicate_update(self):
|
||||
self.sb.update(self.msi, self.sample_objs)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ class XapianSearchQueryTestCase(TestCase):
|
|||
self.sq.add_filter(SQ(content=True))
|
||||
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(true)')
|
||||
|
||||
def test_build_query_date(self):
|
||||
self.sq.add_filter(SQ(content=datetime.date(2009, 5, 8)))
|
||||
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(20090508000000)')
|
||||
|
||||
def test_build_query_datetime(self):
|
||||
self.sq.add_filter(SQ(content=datetime.datetime(2009, 5, 8, 11, 28)))
|
||||
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(20090508112800)')
|
||||
|
|
|
|||
|
|
@ -734,10 +734,10 @@ class SearchQuery(BaseSearchQuery):
|
|||
expression, term = child
|
||||
field, filter_type = search_node.split_expression(expression)
|
||||
|
||||
if not isinstance(term, (list, tuple)):
|
||||
term = _marshal_term(term)
|
||||
else:
|
||||
if isinstance(term, (list, tuple)):
|
||||
term = [_marshal_term(t) for t in term]
|
||||
else:
|
||||
term = _marshal_term(term)
|
||||
|
||||
if field == 'content':
|
||||
query_list.append(self._content_field(term, is_not))
|
||||
|
|
@ -928,11 +928,11 @@ def _marshal_term(term):
|
|||
term = _marshal_datetime(term)
|
||||
elif isinstance(term, datetime.date):
|
||||
term = _marshal_date(term)
|
||||
elif isinstance(term, bool):
|
||||
if term:
|
||||
term = u'true'
|
||||
else:
|
||||
term = u'false'
|
||||
# elif isinstance(term, bool):
|
||||
# if term:
|
||||
# term = u'true'
|
||||
# else:
|
||||
# term = u'false'
|
||||
else:
|
||||
term = force_unicode(term).lower()
|
||||
return term
|
||||
|
|
|
|||
Loading…
Reference in a new issue