def test_setTimeoutCancleAlreadyCancelled(self):
        """
        When the timeout was already cancelled from an external place,
        calling setTimeout with C{None} to explicitly cancel it will clean
        up the timeout without raising any exception.
        """
        self.proto.setTimeout(3)
        # We trigger an external cancelling of that timeout, for example
        # when the reactor is stopped.
        self.clock.getDelayedCalls()[0].cancel()
        self.assertIsNotNone(self.proto.timeOut)

        self.proto.setTimeout(None)

        self.assertIsNone(self.proto.timeOut)

        When the timeout was already cancelled from an external place,
        calling setTimeout with C{None} to explicitly cancel it will clean
        up the timeout without raising any exception.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_policies.py