def test_content(self):
        """
        Content produced by the iterator returned by the application object is
        written to the request as it is produced.
        """
        channel = DummyChannel()

        intermediateValues = []
        def record():
            intermediateValues.append(channel.transport.written.getvalue())

        def applicationFactory():
            def application(environ, startResponse):
                startResponse('200 OK', [('content-length', '6')])
                yield b'foo'
                record()
                yield b'bar'
                record()
            return application

        d, requestFactory = self.requestFactoryFactory()
        def cbRendered(ignored):
            self.assertEqual(
                self.getContentFromResponse(intermediateValues[0]),
                b'foo')
            self.assertEqual(
                self.getContentFromResponse(intermediateValues[1]),
                b'foobar')
        d.addCallback(cbRendered)

        self.lowLevelRender(
            requestFactory, applicationFactory,
            lambda: channel, 'GET', '1.1', [], [''], None, [])

        return d

        Content produced by the iterator returned by the application object is
        written to the request as it is produced.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_wsgi.py