示例#1
0
    def testIfElse(self):
        # Missing else:
        q = query.Query(
            ast.IfElse(
                ast.Pair(ast.Literal(True), ast.Literal("foo")),
                ast.Pair(ast.Literal(True), ast.Literal("bar"))))

        with self.assertRaises(errors.EfilterLogicError):
            validate.validate(q)
示例#2
0
 def testVariadicExpression(self):
     # Variadic should check all children:
     q = query.Query("10 * 15 * 'foo' * 20")
     with self.assertRaises(errors.EfilterTypeError):
         validate.validate(q)
示例#3
0
    def testBinaryExpression(self):
        q = query.Query("5.member")

        with self.assertRaises(errors.EfilterTypeError):
            validate.validate(q)
示例#4
0
 def testComplement(self):
     # Numbers implement IBoolean so this should work.
     q = query.Query("not 5")
     self.assertTrue(validate.validate(q),
                     mocks.MockRootType)
示例#5
0
 def testValueExpression(self):
     q = query.Query("proc.pid + 5")
     self.assertTrue(validate.validate(q, mocks.MockRootType))
示例#6
0
 def testQuery(self):
     q = query.Query("5 + 'foo'")
     with self.assertRaises(errors.EfilterTypeError):
         validate.validate(q)