code: def test_long_aslong(self):
      # Test PyLong_AsLong() and PyLong_FromLong()
      aslong = _testcapi.pylong_aslong
      from _testcapi import LONG_MIN, LONG_MAX
  
      # round trip (object -> long -> object)
      for value in (LONG_MIN, LONG_MAX, -1, 0, 1, 1234):
          with self.subTest(value=value):
              self.assertEqual(aslong(value), value)
  
      self.assertEqual(aslong(IntSubclass(42)), 42)
      self.assertEqual(aslong(Index(42)), 42)
      self.assertEqual(aslong(MyIndexAndInt()), 10)
  
      self.assertRaises(OverflowError, aslong, LONG_MIN - 1)
      self.assertRaises(OverflowError, aslong, LONG_MAX + 1)
      self.assertRaises(TypeError, aslong, 1.0)
      self.assertRaises(TypeError, aslong, b"2")
      self.assertRaises(TypeError, aslong, "3")
      self.assertRaises(SystemError, aslong, NULL)
  
imports: import unittest
  import sys
  from test.support import import_helper
label_desc: Use image node_id 10 for calling the LongTests obj's underlying member method code with example usage: obj.test_long_aslong() without return types