def test_HTTPChannelStopRequestProducer(self):
        """
        If there is a request producer registered with L{HTTPChannel}, calling
        C{stopProducing} causes that producer to be stopped as well.
        """
        channel, transport = self.buildChannelAndTransport(
            StringTransport(), DelayedHTTPHandler
        )

        # Feed a request in to spawn a Request object, then grab it.
        channel.dataReceived(self.request)
        request = channel.requests[0].original

        # Register a dummy producer.
        producer = DummyProducer()
        request.registerProducer(producer, True)

        # The dummy producer is currently unpaused.
        self.assertEqual(producer.events, [])

        # The transport now stops production. This stops the request producer.
        channel.stopProducing()
        self.assertEqual(producer.events, ['stop'])

        If there is a request producer registered with L{HTTPChannel}, calling
        C{stopProducing} causes that producer to be stopped as well.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_http.py