Exemplo n.º 1
0
 def test_pull_producer(self):
     """
     A MemoryConsumer accumulates all data sent by a non-streaming producer.
     """
     consumer = MemoryConsumer()
     producer = Producer(consumer, [b"abc", b"def", b"ghi"])
     consumer.registerProducer(producer, False)
     self.assertEqual(consumer.chunks, [b"abc", b"def", b"ghi"])
     self.assertEqual(consumer.done, True)
Exemplo n.º 2
0
 def _then(ign):
     c5 = MemoryConsumer()
     d1 = version.read(c5)
     c5.producer.stopProducing()
     return self.shouldFail(DownloadStopped, kind + "_stop_imm2",
                            "our Consumer called stopProducing()",
                            lambda: d1)