API/TST: make hasnans always return python booleans
State: closed

- [x] xref #23294
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

``Index.hasnans`` currently returns either a python or a numpy boolean, depending on circumstances. This PR ensures that only python booleans ae returned and makes the tests for hasnans stricter.


Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
lgtm ping on green
It's failing for `Series.hasnans`, which still returns a numpy bool
Hello @topper-123! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimelike.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/core/arrays/datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/core/base.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/core/base.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/base.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/core/indexes/base.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/common.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/common.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/datetimes/test_ops.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/datetimes/test_ops.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/interval/test_interval.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/interval/test_interval.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/multi/test_missing.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/multi/test_missing.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/period/test_ops.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/period/test_ops.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/timedeltas/test_ops.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/indexes/timedeltas/test_ops.py) !

 - There are no PEP8 issues in the file [`pandas/tests/series/test_internals.py`](https://github.com/topper-123/pandas/blob/aa0fa5ab10c39f7a27e51ab72347ec8b1e229e2a/pandas/tests/series/test_internals.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23349?src=pr&el=h1) Report
> Merging [#23349](https://codecov.io/gh/pandas-dev/pandas/pull/23349?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/caea25a8b91d62b30eef99aa0c523448e19cd6db?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

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

```diff
@@           Coverage Diff           @@
##           master   #23349   +/-   ##
=======================================
  Coverage   92.22%   92.22%           
=======================================
  Files         169      169           
  Lines       51261    51261           
=======================================
  Hits        47277    47277           
  Misses       3984     3984
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.66% <100%> (ø)` | :arrow_up: |
| #single | `42.23% <66.66%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23349?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23349/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `93.21% <100%> (ø)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/23349/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.61% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/23349/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.61% <100%> (ø)` | :arrow_up: |

------

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

All green now.