'When the L{NonStreamingProducer} has resumeProducing called 10 times,
it writes the counter each time and then fails.'

def test_producesOnly10Times(self):

    consumer = TestConsumer()
    producer = NonStreamingProducer(consumer)
    consumer.registerProducer(producer, False)
    self.assertIs(consumer.producer, producer)
    self.assertIs(producer.consumer, consumer)
    self.assertFalse(consumer.producerStreaming)
    for _ in range(10):
        producer.resumeProducing()
    expectedWrites = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    self.assertIsNone(consumer.producer)
    self.assertIsNone(consumer.producerStreaming)
    self.assertIsNone(producer.consumer)
    self.assertEqual(consumer.writes, expectedWrites)
    self.assertRaises(RuntimeError, producer.resumeProducing)
