code: def test_cancel(self):
      f1 = create_future(state=PENDING)
      f2 = create_future(state=RUNNING)
      f3 = create_future(state=CANCELLED)
      f4 = create_future(state=CANCELLED_AND_NOTIFIED)
      f5 = create_future(state=FINISHED, exception=OSError())
      f6 = create_future(state=FINISHED, result=5)
  
      self.assertTrue(f1.cancel())
      self.assertEqual(f1._state, CANCELLED)
  
      self.assertFalse(f2.cancel())
      self.assertEqual(f2._state, RUNNING)
  
      self.assertTrue(f3.cancel())
      self.assertEqual(f3._state, CANCELLED)
  
      self.assertTrue(f4.cancel())
      self.assertEqual(f4._state, CANCELLED_AND_NOTIFIED)
  
      self.assertFalse(f5.cancel())
      self.assertEqual(f5._state, FINISHED)
  
      self.assertFalse(f6.cancel())
      self.assertEqual(f6._state, FINISHED)
  
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 10 for calling the FutureTests obj's underlying member method code with example usage: obj.test_cancel() without return types