Six passing tests. Combining AND, OR, NOT works.

This commit is contained in:
David Sauve 2009-11-10 21:53:32 -05:00
parent d7e606f0d5
commit d6a24ef33c

View file

@ -70,12 +70,11 @@ class XapianSearchQueryTestCase(TestCase):
self.sq.add_filter(SQ(content='hello') | SQ(content='world'))
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query((hello OR world))')
# def test_build_query_multiple_words_mixed(self):
# self.sq.add_filter('content', 'why')
# self.sq.add_filter('content', 'hello', use_or=True)
# self.sq.add_filter('content', 'world', use_not=True)
# self.assertEqual(self.sq.build_query(), 'why OR hello NOT world')
#
def test_build_query_multiple_words_mixed(self):
self.sq.add_filter(SQ(content='why') | SQ(content='hello'))
self.sq.add_filter(~SQ(content='world'))
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(((why OR hello) AND (<alldocuments> AND_NOT world)))')
# def test_build_query_phrase(self):
# self.sq.add_filter('content', 'hello world')
# self.assertEqual(self.sq.build_query(), '"hello world"')