def assertCancelDuringBodyProduction(self, producerLength):
        transport = StringTransport()
        protocol = HTTP11ClientProtocol()
        protocol.makeConnection(transport)
        producer = StringProducer(producerLength)

        nonLocal = {'cancelled': False}
        def cancel(ign):
            nonLocal['cancelled'] = True
        def startProducing(consumer):
            producer.consumer = consumer
            producer.finished = Deferred(cancel)
            return producer.finished
        producer.startProducing = startProducing

        result = protocol.request(Request(b'POST', b'/bar', _boringHeaders,
                                          producer))
        producer.consumer.write(b'x' * 5)
        result.cancel()
        self.assertTrue(transport.aborting)
        self.assertTrue(nonLocal['cancelled'])
        return assertRequestGenerationFailed(self, result, [CancelledError])
Escape and quote a string to be used as an HTTP attribute.
dataset/ETHPy150Open twisted/twisted/twisted/web/test/test_newclient.py/HTTP11ClientProtocolTests.assertCancelDuringBodyProduction--crossover with--dataset/ETHPy150Open Arelle/Arelle/arelle/webserver/bottle.py/html_quote