Esempio n. 1
0
    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"')
Esempio n. 2
0
    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"')
Esempio n. 3
0
    def testField(self):
        qspec = qsb_field("DOC_NAME")

        is_field_QSpec(qspec, True)

        result = render_query_string(qspec)

        self.assertEqual(result, u'DOC_NAME')
Esempio n. 4
0
    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')
Esempio n. 5
0
    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')
Esempio n. 6
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')
Esempio n. 7
0
    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')
Esempio n. 8
0
    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"')
Esempio n. 9
0
    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')