class_docstr: Tests common to IntervalIndex with any subtype
class_docstr_tok: ["Tests","common","to","IntervalIndex","with","any","subtype"]
code: def test_astype_category(self, index):
      result = index.astype("category")
      expected = CategoricalIndex(index.values)
      tm.assert_index_equal(result, expected)
  
      result = index.astype(CategoricalDtype())
      tm.assert_index_equal(result, expected)
  
      # non-default params
      categories = index.dropna().unique().values[:-1]
      dtype = CategoricalDtype(categories=categories, ordered=True)
      result = index.astype(dtype)
      expected = CategoricalIndex(
          index.values, categories=categories, ordered=True
      )
      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 3 for calling the AstypeTests obj's underlying member method code with example usage: obj.test_astype_category(index) without return types