class_docstr: Tests specific to IntervalIndex with datetime-like subtype
class_docstr_tok: ["Tests","specific","to","IntervalIndex","with","datetime-like","subtype"]
code: def test_subtype_integer(self, index, subtype):
      dtype = IntervalDtype(subtype, "right")
  
      if subtype != "int64":
          msg = (
              r"Cannot convert interval\[(timedelta64|datetime64)\[ns.*\], .*\] "
              r"to interval\[uint64, .*\]"
          )
          with pytest.raises(TypeError, match=msg):
              index.astype(dtype)
          return
  
      result = index.astype(dtype)
      new_left = index.left.astype(subtype)
      new_right = index.right.astype(subtype)
  
      expected = IntervalIndex.from_arrays(
          new_left, new_right, closed=index.closed
      )
      tm.assert_index_equal(result, expected)
  
imports: import re
  import numpy
  import pytest
  from pandas.core.dtypes.dtypes import CategoricalDtype, IntervalDtype
  from pandas import CategoricalIndex, Index, IntervalIndex, NaT, Timedelta, Timestamp, interval_range
  import pandas._testing
label_desc: Use image node_id 2 for calling the TestDatetimelikeSubtype obj's underlying member method code with example usage: obj.test_subtype_integer(index, subtype) without return types