code: def test_loc_with_slices(
      self, series_with_interval_index, indexer_sl
  ):
      # loc with slices:
      #   - Interval objects: only works with exact matches
      #   - scalars: only works for non-overlapping, monotonic intervals,
      #     and start/stop select location based on the interval that
      #     contains them:
      #    (slice_loc(start, stop) == (idx.get_loc(start), idx.get_loc(stop))
  
      ser = series_with_interval_index.copy()
  
      # slice of interval
  
      expected = ser.iloc[:3]
      result = indexer_sl(ser)[Interval(0, 1) : Interval(2, 3)]
      tm.assert_series_equal(expected, result)
  
      expected = ser.iloc[3:]
      result = indexer_sl(ser)[Interval(3, 4) :]
      tm.assert_series_equal(expected, result)
  
      msg = "Interval objects are not currently supported"
      with pytest.raises(NotImplementedError, match=msg):
          indexer_sl(ser)[Interval(3, 6) :]
  
      with pytest.raises(NotImplementedError, match=msg):
          indexer_sl(ser)[Interval(3, 4, closed="left") :]
  
file_path: pandas/pandas/tests/indexing/interval/test_interval_new.py
imports: import re
  import numpy
  import pytest
  from pandas.compat import IS64
  from pandas import Index, Interval, IntervalIndex, Series
  import pandas._testing
label_desc: Use image node_id 4 for calling the TestIntervalIndex obj's underlying member method code with example usage: obj.test_loc_with_slices(series_with_interval_index, indexer_sl) without return types