code: def test_cut_return_intervals():
      ser = Series([0, 1, 2, 3, 4, 5, 6, 7, 8])
      result = cut(ser, 3)
  
      exp_bins = np.linspace(0, 8, num=4).round(3)
      exp_bins[0] -= 0.008
  
      expected = Series(
          IntervalIndex.from_breaks(exp_bins, closed="right").take(
              [0, 0, 0, 1, 1, 1, 2, 2, 2]
          )
      ).astype(CategoricalDtype(ordered=True))
      tm.assert_series_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import Categorical, DataFrame, DatetimeIndex, Index, Interval, IntervalIndex, Series, TimedeltaIndex, Timestamp, cut, date_range, interval_range, isna, qcut, timedelta_range, to_datetime
  import pandas._testing
  from pandas.api.types import CategoricalDtype
  import pandas.core.reshape.tile
label_desc: Use image node_id 25 for calling a global function with example usage: test_cut_return_intervals() without return types