def test_circularChainException(self):
        """
        If the deprecation warning for circular deferred callbacks is
        configured to be an error, the exception will become the failure
        result of the Deferred.
        """
        self.addCleanup(setattr, warnings, "filters", warnings.filters)
        warnings.filterwarnings("error", category=DeprecationWarning)
        d = defer.Deferred()
        def circularCallback(result):
            return d
        d.addCallback(circularCallback)
        d.callback("foo")
        failure = self.failureResultOf(d)
        failure.trap(DeprecationWarning)

        If the deprecation warning for circular deferred callbacks is
        configured to be an error, the exception will become the failure
        result of the Deferred.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defer.py