

def test_consumerToProtocol(self):
    '\n        L{IConsumer} providers can be adapted to L{IProtocol} providers using\n        L{ProtocolToConsumerAdapter}.\n        '
    result = []

    @implementer(IConsumer)
    class Consumer(object):

        def write(self, d):
            result.append(d)
    c = Consumer()
    protocol = IProtocol(c)
    protocol.dataReceived(b'hello')
    self.assertEqual(protocol, [b'hello'])
    self.assertIsInstance(protocol, ConsumerToProtocolAdapter)

dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py AdapterTests.test_consumerToProtocol/VarMisuse@76/132 `result`->`protocol`