Exemple #1
0
 def test_expr_function__and_plus_minus(self):
     self.assertParse(
         qSelect(qp.Wildcard(),
                 where_clause=qp.And(qp.Add(qp.Column('a'), qp.Column('b')),
                                     qp.Sub(qp.Column('c'),
                                            qp.Column('d')))),
         "SELECT * WHERE a + b AND c - d;")
Exemple #2
0
    def test_expr_numerical(self):
        expected = qSelect(
            [qp.Target(qp.Add(qp.Constant(2), qp.Constant(3)), None)])
        self.assertParse(expected, "SELECT 2+(3);")

        expected = qSelect(
            [qp.Target(qp.Sub(qp.Constant(2), qp.Constant(3)), None)])
        self.assertParse(expected, "SELECT 2-(3);")
Exemple #3
0
 def test_expr_function__mul_div_plus_minus(self):
     self.assertParse(
         qSelect(qp.Wildcard(),
                 where_clause=qp.Sub(
                     qp.Add(
                         qp.Mul(qp.Column(name='a'), qp.Column(name='b')),
                         qp.Div(qp.Column(name='c'), qp.Column(name='d'))),
                     qp.Constant(value=3))),
         "SELECT * WHERE a * b + c / d - 3;")
Exemple #4
0
 def test_expr_add(self):
     expected = qSelect(
         [qp.Target(qp.Add(qp.Column('a'), qp.Column('b')), None)])
     self.assertParse(expected, "SELECT a + b;")
     self.assertParse(expected, "SELECT a+b;")