def test_brackets(self):
     for i in range(1, 7):
         self.add_param("q%s" % i)
     self.params = "q1 & ((q2 |q3| q4) & !(q5 & q6))"
     self.assertEqual(
         self.parsed_result,
         And("q1", And(Or("q2", Or("q3", "q4")), Not(And("q5", "q6")))))
    def test_complex(self):
        for i in range(1, 6):
            self.add_param("q%s" % i)
        self.params = "q1 & q2 | q3 | q4 & !q5"

        self.assertEqual(self.parsed_result,
                         Or(And("q1", "q2"), Or("q3", And(
                             "q4",
                             Not("q5"),
                         ))))
 def test_filter_and(self):
     self.query.add('fullname', filter='eq', value='The User')
     self.query.add('name', filter='eq', value='user2')
     self.query.param_order = And(
         self.query.get_param('fullname'),
         self.query.get_param('name'),
     )
     expect(self.evaluated_qry.first()).to(be_none)
Ejemplo n.º 4
0
 def test_or_neq_other_type(self):
     self.assertNotEqual(
         Or("q1", "q2"),
         And("q1", "q2"),
     )
Ejemplo n.º 5
0
 def test_and_neq_other_type(self):
     self.assertNotEqual(
         And("q1", "q2"),
         Or("q1", "q2"),
     )
Ejemplo n.º 6
0
 def test_and_neq(self):
     self.assertNotEqual(
         And("q1", "q2"),
         And("q1", "q3"),
     )
Ejemplo n.º 7
0
 def test_and_eq(self):
     self.assertEqual(
         And("q1", "q2"),
         And("q1", "q2"),
     )
Ejemplo n.º 8
0
 def test_neq_param_other(self):
     self.assertNotEqual(
         Parameter("q1"),
         And("a", "b"),
     )
    def test_and(self):
        self.params = "q1 & q2"
        self.add_param("q1")
        self.add_param("q2")

        self.assertEqual(self.parsed_result, And("q1", "q2"))