'Test URL Expression parsing'

def testParseExpression(self):

    assertEqual = self.assertEqual
    parse = S3URLQuery.parse_expression
    items = [('s', ['s'], 'eq', False), ('s!', ['s'], 'eq', True), ('s__op', ['s'], 'op', False), ('s__op!', ['s'], 'op', True), ('s1|s2|s3', ['s1', 's2', 's3'], 'eq', False), ('s1|s2|s3!', ['s1', 's2', 's3'], 'eq', True), ('s1|s2|s3__op', ['s1', 's2', 's3'], 'op', False), ('s1|s2|s3__op!', ['s1', 's2', 's3'], 'op', True), ('s__', ['s'], 'eq', False), ('s___', ['s'], 'eq', False), ('s_____ne', ['s'], 'ne', False), ('s__!', ['s'], 'eq', True), ('s!__op', ['s!'], 'op', False), ('s__!op', ['s'], '!op', False), ('s1||s3', ['s1', 's3'], 'eq', False), ('s1|s2|s3__', ['s1', 's2', 's3'], 'eq', False), ('s1|s2|s3__!', ['s1', 's2', 's3'], 'eq', True), ('s1|s2|s3!__op', ['s1', 's2', 's3!'], 'op', False), ('s1|s2|s3__!op', ['s1', 's2', 's3'], '!op', False)]
    for (key, selectors, op, invert) in items:
        (s, o, i) = parse(key)
        assertEqual((key, s, o, i), (key, selectors, op, invert))
