class_docstr: Tests common to IntervalIndex with any subtype
class_docstr_tok: ["Tests","common","to","IntervalIndex","with","any","subtype"]
code: def test_astype_cannot_cast(self, index, dtype):
      msg = "Cannot cast IntervalIndex to dtype"
      with pytest.raises(TypeError, match=msg):
          index.astype(dtype)
  
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 4 for calling the AstypeTests obj's underlying member method code with example usage: obj.test_astype_cannot_cast(index, dtype) without return types