'Test query construction'

def testQuery(self):

    p = S3URLQueryParser()
    assertTrue = self.assertTrue
    assertEqual = self.assertEqual
    assertIn = self.assertIn
    examples = ((('example', 'eq', '1'), True, None, '1'), (('test.example', 'contains', 'ab,cd,ef'), True, 'test', ['ab', 'cd', 'ef']), ((None, 'gt', '1'), False, None, None), (('~.example', 'like', 'Ex*mple'), True, None, 'ex%mple'))
    for (example, success, alias, pvalue) in examples:
        (selector, op, value) = example
        if (selector is None):
            qdict = p._query(op, None, value)
        else:
            qdict = p._query(op, FS(selector), value)
        if success:
            assertTrue(isinstance(qdict, dict))
            assertEqual(len(qdict), 1)
            assertIn(alias, qdict)
            query = qdict[alias]
            assertTrue(isinstance(query, S3ResourceQuery))
            assertTrue(isinstance(query.left, S3FieldSelector))
            assertEqual(query.left.name, selector)
            assertEqual(query.op, op)
            assertEqual(query.right, pvalue)
        else:
            assertEqual(qdict, {})
