def test_unary_both_ops(self): assert_raises_message( exc.CompileError, "Unary expression does not support operator and " "modifier simultaneously", UnaryExpression(literal("x"), operator=operators.custom_op("x"), modifier=operators.custom_op("y")).compile)
def expression(self, args): if len(args) == 1: # it's a list expression return args[0] left, op, right = args inverse = False if type(op) is tuple: op = op[0] inverse = True exp = BinaryExpression(left, right, op) if inverse: exp = UnaryExpression(exp, operator=operator.inv) return exp
def ttl_delete(expr): return UnaryExpression(expr, modifier=custom_op('DELETE'))
def test_unary_no_ops(self): assert_raises_message( exc.CompileError, "Unary expression has no operator or modifier", UnaryExpression(literal("x")).compile )
def factorial_prefix(self): return UnaryExpression(self.expr, operator=operators.custom_op("!!"), type_=MyInteger)
def factorial(self): return UnaryExpression(self.expr, modifier=operators.custom_op("!"), type_=MyInteger)