Esempio n. 1
0
 def test_comparison(self):
     self.check_operator_parser('=', AST.Eq)
     self.check_operator_parser('!=', AST.Neq)
     self.check_operator_parser('<', AST.Lt)
     self.check_operator_parser('<=', AST.Lte)
     self.check_operator_parser('>', AST.Gt)
     self.check_operator_parser('>=', AST.Gte)
     self.check_parser('%s between %s and %s' % (DATE_STR, CONTEXT_STR, LIST_STR),
                       AST.Between(DATE_AST, CONTEXT_AST, LIST_AST))
     # self.check_parser('%s between %s and %s' % (FILTER_EXPRESSION_STR, INSTANCE_OF_STR, LIST_STR),
     #                   AST.Between(FILTER_EXPRESSION_AST, INSTANCE_OF_AST, LIST_AST),
     #                   debug=True)
     self.check_parser('%s in  null' % DATE_STR,
                       AST.In(DATE_AST, AST.PositiveUnaryTests([AST.Null()])))
     self.check_parser('%s in  null' % FILTER_EXPRESSION_STR,
                       AST.In(FILTER_EXPRESSION_AST, AST.PositiveUnaryTests([AST.Null()])))
     # self.check_parser('%s in null' % FILTER_EXPRESSION_STR, AST.In(FILTER_EXPRESSION_AST, [AST.Null]))
     self.check_parser('%s in (null, null)' % FILTER_EXPRESSION_STR,
                       AST.In(FILTER_EXPRESSION_AST, AST.PositiveUnaryTests([AST.Null()] * 2)))
Esempio n. 2
0
 def p_between(self, p):
     """between : between1 AND expression  %prec comparison_p"""
     expr, begin_start = p[1]
     begin_end = p[3]
     p[0] = AST.Between(expr, begin_start, begin_end)