Example #1
0
    def test_is_aggregate_derived(self):
        columns, aggregates = qc.get_columns_and_aggregates(
            qc.EvalAnd(
                qc.EvalEqual(qe.PositionColumn(), qc.EvalConstant(42)),
                qc.EvalOr(
                    qc.EvalNot(qc.EvalEqual(qe.DateColumn(),
                                            qc.EvalConstant(datetime.date(2014, 1, 1)))),
                    qc.EvalConstant(False))))
        self.assertEqual((2, 0), (len(columns), len(aggregates)))

        columns, aggregates = qc.get_columns_and_aggregates(
            qc.EvalAnd(
                qc.EvalEqual(qe.PositionColumn(), qc.EvalConstant(42)),
                qc.EvalOr(
                    qc.EvalNot(qc.EvalEqual(qe.DateColumn(),
                                            qc.EvalConstant(datetime.date(2014, 1, 1)))),
                    # Aggregation node deep in the tree.
                    qe.Sum([qc.EvalConstant(1)]))))
        self.assertEqual((2, 1), (len(columns), len(aggregates)))
Example #2
0
 def test_expr_unaryop(self):
     self.assertEqual(
         qc.EvalNot(qe.AccountColumn()),
         qc.compile_expression(qp.Not(qp.Column('account')),
                               qe.TargetsEnvironment()))
Example #3
0
 def test_compile_EvalNot(self):
     c_not = qc.EvalNot(qc.EvalConstant(17))
     self.assertEqual(bool, c_not.dtype)