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)
def testVariadicExpression(self): # Variadic should check all children: q = query.Query("10 * 15 * 'foo' * 20") with self.assertRaises(errors.EfilterTypeError): validate.validate(q)
def testBinaryExpression(self): q = query.Query("5.member") with self.assertRaises(errors.EfilterTypeError): validate.validate(q)
def testComplement(self): # Numbers implement IBoolean so this should work. q = query.Query("not 5") self.assertTrue(validate.validate(q), mocks.MockRootType)
def testValueExpression(self): q = query.Query("proc.pid + 5") self.assertTrue(validate.validate(q, mocks.MockRootType))
def testQuery(self): q = query.Query("5 + 'foo'") with self.assertRaises(errors.EfilterTypeError): validate.validate(q)