'Test conjunction of query dicts'

def testAnd(self):

    p = S3URLQueryParser()
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    assertIn = self.assertIn
    q1 = (S3FieldSelector('~.test1') == 'A')
    q2 = (S3FieldSelector('x.test2') == 'B')
    q3 = (S3FieldSelector('x.test3') == 'C')
    q4 = (S3FieldSelector('y.test4') == 'D')
    qdict1 = {None: q1, 'x': q2}
    qdict2 = {'x': q3, 'y': q4}
    result = p._and(qdict1, qdict2)
    assertTrue(isinstance(result, dict))
    assertEqual(len(result), 3)
    assertIn(None, result)
    assertEqual(result[None], q1)
    assertIn('x', result)
    query = result['x']
    assertEqual(query.op, query.AND)
    operands = (query.left, query.right)
    assertIn(q2, operands)
    assertIn(q3, operands)
    assertIn('y', result)
    assertEqual(result['y'], q4)
