code: def test_int_returns_int_subclass(self):
      class BadIndex:
          def __index__(self):
              return True
  
      class BadIndex2(int):
          def __index__(self):
              return True
  
      class BadInt:
          def __int__(self):
              return True
  
      class BadInt2(int):
          def __int__(self):
              return True
  
      class TruncReturnsBadIndex:
          def __trunc__(self):
              return BadIndex()
  
      class TruncReturnsBadInt:
          def __trunc__(self):
              return BadInt()
  
      class TruncReturnsIntSubclass:
          def __trunc__(self):
              return True
  
      bad_int = BadIndex()
      with self.assertWarns(DeprecationWarning):
          n = int(bad_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), int)
  
      bad_int = BadIndex2()
      n = int(bad_int)
      self.assertEqual(n, 0)
      self.assertIs(type(n), int)
  
      bad_int = BadInt()
      with self.assertWarns(DeprecationWarning):
          n = int(bad_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), int)
  
      bad_int = BadInt2()
      with self.assertWarns(DeprecationWarning):
          n = int(bad_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), int)
  
      bad_int = TruncReturnsBadIndex()
      with self.assertWarns(DeprecationWarning):
          n = int(bad_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), int)
  
      bad_int = TruncReturnsBadInt()
      with self.assertWarns(DeprecationWarning):
          self.assertRaises(TypeError, int, bad_int)
  
      good_int = TruncReturnsIntSubclass()
      with self.assertWarns(DeprecationWarning):
          n = int(good_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), int)
      with self.assertWarns(DeprecationWarning):
          n = IntSubclass(good_int)
      self.assertEqual(n, 1)
      self.assertIs(type(n), IntSubclass)
  
imports: import sys
  import time
  import unittest
  from unittest import mock
  from test import support
  from test.test_grammar import VALID_UNDERSCORE_LITERALS, INVALID_UNDERSCORE_LITERALS
label_desc: Use image node_id 17 for calling the IntTestCases obj's underlying member method code with example usage: obj.test_int_returns_int_subclass() and returns: True, True, True, True, BadIndex, BadInt, True