code: def test_refcounting(self):
      objects = [object() for i in range(10)]
      for mode in ("raise", "clip", "wrap"):
          a = np.array(objects)
          b = np.array([2, 2, 4, 5, 3, 5])
          a.take(b, out=a[:6], mode=mode)
          del a
          if HAS_REFCOUNT:
              assert_(all(sys.getrefcount(o) == 3 for o in objects))
          # not contiguous, example:
          a = np.array(objects * 2)[::2]
          a.take(b, out=a[:6], mode=mode)
          del a
          if HAS_REFCOUNT:
              assert_(all(sys.getrefcount(o) == 3 for o in objects))
  
file_path: numpy/numpy/_core/tests/test_item_selection.py
imports: import sys
  import pytest
  import numpy
  from numpy.testing import assert_, assert_raises, assert_array_equal, HAS_REFCOUNT
label_desc: Use image node_id 2 for calling the TestTake obj's underlying member method code with example usage: obj.test_refcounting() without return types