'Test operator precedence.'

def testParser2(self):

    ast = lexer.SearchParser('    \'file    name\'    contains    "hello"    and    size    >    100k\nor    \'file    name\'    contains    "foo"    and    date    before    "2011-10"    ').Parse()
    self.assertEqual(ast.operator, 'or')
    self.assertEqual(ast.args[0].operator, 'and')
    self.assertEqual(ast.args[0].args[0].attribute, 'file    name')
    self.assertEqual(ast.args[0].args[0].operator, 'contains')
    self.assertEqual(ast.args[0].args[0].args[0], 'hello')
    self.assertEqual(ast.args[0].args[1].attribute, 'size')
    self.assertEqual(ast.args[0].args[1].operator, '>')
    self.assertEqual(ast.args[0].args[1].args[0], '100k')
    self.assertEqual(ast.args[1].operator, 'and')
    self.assertEqual(ast.args[1].args[0].attribute, 'file    name')
    self.assertEqual(ast.args[1].args[0].operator, 'contains')
    self.assertEqual(ast.args[1].args[0].args[0], 'foo')
    self.assertEqual(ast.args[1].args[1].attribute, 'date')
    self.assertEqual(ast.args[1].args[1].operator, 'before')
    self.assertEqual(ast.args[1].args[1].args[0], '2011-10')
