code: def test_long_as_ssize_t(self):
      # Test PyLong_AsSsize_t() and PyLong_FromSsize_t()
      as_ssize_t = _testcapi.pylong_as_ssize_t
      from _testcapi import PY_SSIZE_T_MIN, PY_SSIZE_T_MAX
  
      # round trip (object -> Py_ssize_t -> object)
      for value in (PY_SSIZE_T_MIN, PY_SSIZE_T_MAX, -1, 0, 1, 1234):
          with self.subTest(value=value):
              self.assertEqual(as_ssize_t(value), value)
  
      self.assertEqual(as_ssize_t(IntSubclass(42)), 42)
      self.assertRaises(TypeError, as_ssize_t, Index(42))
      self.assertRaises(TypeError, as_ssize_t, MyIndexAndInt())
  
      self.assertRaises(OverflowError, as_ssize_t, PY_SSIZE_T_MIN - 1)
      self.assertRaises(OverflowError, as_ssize_t, PY_SSIZE_T_MAX + 1)
      self.assertRaises(TypeError, as_ssize_t, 1.0)
      self.assertRaises(TypeError, as_ssize_t, b"2")
      self.assertRaises(TypeError, as_ssize_t, "3")
      self.assertRaises(SystemError, as_ssize_t, NULL)
  
imports: import unittest
  import sys
  from test.support import import_helper
label_desc: Use image node_id 18 for calling the LongTests obj's underlying member method code with example usage: obj.test_long_as_ssize_t() without return types