def test_cancellerArg(self):
        """
        Verify that a canceller is given the correct deferred argument.
        """
        def cancel(d1):
            self.assertIs(d1, d)
        d = defer.Deferred(canceller=cancel)
        d.addCallbacks(self._callback, self._errback)
        d.cancel()

        Verify that a canceller is given the correct deferred argument.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defer.py