code: def test_value_counts(index_or_series_obj):
      obj = index_or_series_obj
      obj = np.repeat(obj, range(1, len(obj) + 1))
      result = obj.value_counts()
  
      counter = collections.Counter(obj)
      expected = Series(
          dict(counter.most_common()), dtype=np.int64, name="count"
      )
  
      if obj.dtype != np.float16:
          expected.index = expected.index.astype(obj.dtype)
      else:
          with pytest.raises(
              NotImplementedError, match="float16 indexes are not "
          ):
              expected.index.astype(obj.dtype)
          return
      if isinstance(expected.index, MultiIndex):
          expected.index.names = obj.names
      else:
          expected.index.name = obj.name
  
      if not isinstance(result.dtype, np.dtype):
          if getattr(obj.dtype, "storage", "") == "pyarrow":
              expected = expected.astype("int64[pyarrow]")
          else:
              # i.e IntegerDtype
              expected = expected.astype("Int64")
  
      # TODO(GH#32514): Order of entries with the same count is inconsistent
      #  on CI (gh-32449)
      if obj.duplicated().any():
          result = result.sort_index()
          expected = expected.sort_index()
      tm.assert_series_equal(result, expected)
  
file_path: pandas/pandas/tests/base/test_value_counts.py
imports: import collections
  from datetime import timedelta
  import numpy
  import pytest
  import pandas
  from pandas import DatetimeIndex, Index, Interval, IntervalIndex, MultiIndex, Series, Timedelta, TimedeltaIndex, array
  import pandas._testing
  from pandas.tests.base.common import allow_na_ops
label_desc: Use image node_id 1 for calling a global function with example usage: test_value_counts(index_or_series_obj) without return types