ENH: Add IntervalDtype support to IntervalIndex.astype
State: closed

- [X] closes #19197
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Summary:
  - Added support for `IntervalIndex.astype(IntervalDtype(...))`
       - Allows for subtype conversion, e.g. `interval[int64]` --> `interval[float64]`
  - Created a new `/interval/test_astype.py` file for the tests
      - Similar to how these tests were split into a separate file for `/datetimes`, and `/timedeltas`
      - Created a base class to hold tests that are common to any subtype
      - Created separate subtypes classes that hold tests for behavior unique to the subtype
      - Significantly expanded the `astype` related tests for `IntervalIndex`
      - Didn't parametrize over `closed`, since it doesn't really come into play for `astype`, though each variation of closed is accounted for among the indexes tested
  - Minor fix to `IntervalDtype` class when an invalid subtype comparison is made
     - See comment on the relevant code change for example

Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Interval
description: Interval data type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=h1) Report
> Merging [#19231](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04778805dd595e37e33f6ef0e02d9337a1154e09?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19231/graphs/tree.svg?src=pr&token=eZ4WkYLtcO&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #19231      +/-   ##
==========================================
- Coverage   91.55%   91.53%   -0.02%     
==========================================
  Files         147      147              
  Lines       48797    48805       +8     
==========================================
- Hits        44675    44673       -2     
- Misses       4122     4132      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.9% <100%> (-0.02%)` | :arrow_down: |
| #single | `41.7% <0%> (+0.09%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/19231/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.38% <100%> (+0.08%)` | :arrow_up: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/19231/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `96.12% <100%> (+0.01%)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/19231/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.22% <0%> (-1.74%)` | :arrow_down: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/19231/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `88.18% <0%> (-0.18%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/19231/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `95.32% <0%> (+0.73%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=footer). Last update [0477880...8caf9f2](https://codecov.io/gh/pandas-dev/pandas/pull/19231?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks @jschendel nice patch!