BUG/TST: Fix TimedeltaIndex comparisons with invalid types
State: closed

Parametrize a handful of tests.

- [x] closes #23063
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Timedelta
description: Timedelta data type

Comments:
Hello @jbrockmendel! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimes.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/core/arrays/datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/timedeltas.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/core/arrays/timedeltas.py) !

 - There are no PEP8 issues in the file [`pandas/core/generic.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/core/generic.py) !

 - There are no PEP8 issues in the file [`pandas/core/ops.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/core/ops.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arithmetic/test_datetime64.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/tests/arithmetic/test_datetime64.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arithmetic/test_timedelta64.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/tests/arithmetic/test_timedelta64.py) !

 - There are no PEP8 issues in the file [`pandas/util/testing.py`](https://github.com/jbrockmendel/pandas/blob/4955142682e4a7646fc865fdcbed8be0f2a1785d/pandas/util/testing.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=h1) Report
> Merging [#24056](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/08395af43b813b69b1cf038d260104cfeeb3e787?src=pr&el=desc) will **increase** coverage by `0.05%`.
> The diff coverage is `47.05%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24056      +/-   ##
==========================================
+ Coverage   42.38%   42.44%   +0.05%     
==========================================
  Files         161      161              
  Lines       51701    51573     -128     
==========================================
- Hits        21914    21890      -24     
+ Misses      29787    29683     -104
```

| Flag | Coverage Δ | |
|---|---|---|
| #single | `42.44% <47.05%> (+0.05%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `51.71% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `55.2% <100%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `39.36% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `63.17% <40%> (-0.62%)` | :arrow_down: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `50.14% <50%> (+11.17%)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `39.82% <0%> (-1.03%)` | :arrow_down: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `39.82% <0%> (-1.02%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `69.9% <0%> (-0.5%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `52.18% <0%> (-0.14%)` | :arrow_down: |
| [pandas/core/arrays/integer.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2ludGVnZXIucHk=) | `37.97% <0%> (-0.09%)` | :arrow_down: |
| ... and [23 more](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24056?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/24056?src=pr&el=footer). Last update [08395af...9df94d9](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=h1) Report
> Merging [#24056](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/4b5f4d1a59a7fce09c47eb0c03ba99a6cea472c6?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `83.33%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24056      +/-   ##
==========================================
- Coverage   92.21%    92.2%   -0.01%     
==========================================
  Files         161      161              
  Lines       51684    51696      +12     
==========================================
+ Hits        47658    47667       +9     
- Misses       4026     4029       +3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <83.33%> (-0.01%)` | :arrow_down: |
| #single | `43% <50%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.41% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `94.13% <100%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.65% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `87.27% <77.77%> (-0.34%)` | :arrow_down: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24056/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.25% <80%> (-0.18%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24056?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/24056?src=pr&el=footer). Last update [4b5f4d1...9b02f5d](https://codecov.io/gh/pandas-dev/pandas/pull/24056?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks!