Example #1
0
    def testPrefixMinusHighPrecedence(self):
        query = "-5 + 5"
        expected = expression.Sum(
            expression.Product(expression.Literal(-1), expression.Literal(5)),
            expression.Literal(5))

        self.assertQueryMatches(query, expected)
Example #2
0
    def testParens(self):
        query = "(3 + 2) * 5"
        expected = expression.Product(
            expression.Sum(expression.Literal(3), expression.Literal(2)),
            expression.Literal(5))

        self.assertQueryMatches(query, expected)
Example #3
0
    def testPrefixMinus(self):
        query = "-(5 + 5)"
        expected = expression.Product(
            expression.Literal(-1),
            expression.Sum(expression.Literal(5), expression.Literal(5)))

        self.assertQueryMatches(query, expected)