def testNot(self): qspec = qsb_not(qsb_eq(qsb_field("dog"), "Poodle")) is_not_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'NOT dog:"Poodle"')
def testEq(self): qspec = qsb_eq(qsb_field("DOC_NAME"), "Noodle") is_eq_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'DOC_NAME:"Noodle"')
def testField(self): qspec = qsb_field("DOC_NAME") is_field_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'DOC_NAME')
def testGt(self): qspec = qsb_gt(qsb_field("abcd"), qsb_number(-1)) is_gt_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'abcd>-1')
def testGe(self): qspec = qsb_ge(qsb_field("ABC"), qsb_number(0)) is_ge_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'ABC>=0')
def testLe(self): qspec = qsb_le(qsb_field("A*B"), qsb_number(45.9)) is_le_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'A_B<=45.9')
def testLt(self): qspec = qsb_lt(qsb_field("ZZZ"), qsb_number(4300)) is_lt_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'ZZZ<4300')
def testOr(self): qspec = qsb_or(qsb_eq(qsb_field("dog"), "Poodle"), qsb_unquoted("Noodle"), "Squirtle") is_or_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'dog:"Poodle" OR Noodle OR "Squirtle"')
def testDistance(self): distqspec = qsb_distance(qsb_field("home_base"), qsb_geopoint(34.5, 22)) is_distance_QSpec(distqspec, True) qspec = qsb_gt(distqspec, 47) is_gt_QSpec(qspec, True) result = render_query_string(qspec) self.assertEqual(result, u'distance(home_base,geopoint(34.5,22))>47')