code: def test_bins_from_interval_index():
      c = cut(range(5), 3)
      expected = c
      result = cut(range(5), bins=expected.categories)
      tm.assert_categorical_equal(result, expected)
  
      expected = Categorical.from_codes(
          np.append(c.codes, -1), categories=c.categories, ordered=True
      )
      result = cut(range(6), bins=expected.categories)
      tm.assert_categorical_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 5 for calling a global function with example usage: test_bins_from_interval_index() without return types