def assertDeferredResult(self, deferred, assertFunction, *args, **kwargs):
        """
        Call the given assertion function against the current result of a
        Deferred.
        """
        result = []
        deferred.addCallback(result.append)
        assertFunction(result[0], *args, **kwargs)

        Call the given assertion function against the current result of a
        Deferred.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_util.py