twisted.internet.interfaces.IConsumer - python examples

Here are the examples of the python api twisted.internet.interfaces.IConsumer taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : test_protocol.py
Copyright MIT License
Author : wistbean
    def test_protocolToConsumer(self):
        """
        L{IProtocol} providers can be adapted to L{IConsumer} providers using
        L{ProtocolToConsumerAdapter}.
        """
        result = []
        p = Protocol()
        p.dataReceived = result.append
        consumer = IConsumer(p)
        consumer.write(b"hello")
        self.astertEqual(result, [b"hello"])
        self.astertIsInstance(consumer, ProtocolToConsumerAdapter)