code: def test_done_callback_with_cancel(self):
      was_cancelled = None
  
      def fn(callback_future):
          nonlocal was_cancelled
          was_cancelled = callback_future.cancelled()
  
      f = Future()
      f.add_done_callback(fn)
      self.assertTrue(f.cancel())
      self.assertTrue(was_cancelled)
  
imports: import threading
  import time
  import unittest
  from concurrent import futures
  from concurrent.futures._base import PENDING, RUNNING, CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED, Future
  from test import support
  from .util import PENDING_FUTURE, RUNNING_FUTURE, CANCELLED_FUTURE, CANCELLED_AND_NOTIFIED_FUTURE, EXCEPTION_FUTURE, SUCCESSFUL_FUTURE, BaseTestCase, create_future, setup_module
label_desc: Use image node_id 3 for calling the FutureTests obj's underlying member method code with example usage: obj.test_done_callback_with_cancel() without return types