예제 #1
0
파일: core.py 프로젝트: pvergain/xotl.ql
 def __rpow__(self, other):
     '''
         >>> 1 ** this    # doctest: +ELLIPSIS
         <expression '1**this' ...>
     '''
     from xotl.ql.expressions import pow_
     return pow_(other, self)
예제 #2
0
파일: core.py 프로젝트: pvergain/xotl.ql
 def __pow__(self, other):
     '''
         >>> this**1    # doctest: +ELLIPSIS
         <expression 'this**1' ...>
     '''
     from xotl.ql.expressions import pow_
     return pow_(self, other)
예제 #3
0
 def __rpow__(self, other):
     '''
         >>> 1 ** this    # doctest: +ELLIPSIS
         <expression '1**this' ...>
     '''
     from xotl.ql.expressions import pow_
     return pow_(other, self)
예제 #4
0
 def __pow__(self, other):
     '''
         >>> this**1    # doctest: +ELLIPSIS
         <expression 'this**1' ...>
     '''
     from xotl.ql.expressions import pow_
     return pow_(self, other)
예제 #5
0
 def test_expression(self):
     from xotl.ql.expressions import (count, ExpressionTree, or_, and_,
                                      pow_, lt, eq, add)
     expr = ((q(1) < 3) & (1 == q("1")) |
             (q("a") + q("b") ** 2 == q("x") + count("y")))
     expected = or_(and_(lt(1, 3), eq(1, "1")),
                    eq(add("a", pow_("b", 2)), add("x", count("y"))))
     self.assertIsInstance(expr, ExpressionTree)
     with context(UNPROXIFING_CONTEXT):
         self.assertTrue(expr == expected, "%s ---- %s" % (expected, expr))
예제 #6
0
 def test_expression(self):
     from xotl.ql.expressions import (count, ExpressionTree, or_, and_,
                                      pow_, lt, eq, add)
     expr = ((q(1) < 3) & (1 == q("1")) |
             (q("a") + q("b")**2 == q("x") + count("y")))
     expected = or_(and_(lt(1, 3), eq(1, "1")),
                    eq(add("a", pow_("b", 2)), add("x", count("y"))))
     self.assertIsInstance(expr, ExpressionTree)
     with context(UNPROXIFING_CONTEXT):
         self.assertTrue(expr == expected, "%s ---- %s" % (expected, expr))