'Test that pipelined FETCH commands which can be responded to
synchronously are responded to correctly.'

def test_synchronousFetch(self):

    mailbox = SynchronousMailbox(self.messages)
    self.server.state = 'select'
    self.server.mbox = mailbox
    self.transport.clear()
    self.server.dataReceived('01    FETCH    1    BODY[]\r\n02    FETCH    2    BODY[]\r\n03    FETCH    3    BODY[]\r\n')
    while self.iterators:
        for e in self.iterators[0][0]:
            break
        else:
            self.iterators.pop(0)[1].callback(None)
    self.assertEqual(self.transport.value(), '*    1    FETCH    (BODY[]    )\r\n01    OK    FETCH    completed\r\n*    2    FETCH    (BODY[]    )\r\n02    OK    FETCH    completed\r\n*    3    FETCH    (BODY[]    )\r\n03    OK    FETCH    completed\r\n')
