dtype validation from 24024
State: closed

Fix tests in tests_datetimelike that are passing incorrect `freq`s

Implements some but not all of the dtype-validation tests in #24024; retains extant error messages instead of those raises in 24024.

Some stream-lining could be done if we change the behavior of `validate_tz_from_dtype`, which includes:

```
            try:
                dtype = DatetimeTZDtype.construct_from_string(dtype)
            except TypeError:
                # Things like `datetime64[ns]`, which is OK for the
                # constructors, but also nonsense, which should be validated
                # but not by us. We *do* allow non-existent tz errors to
                # go through
                pass
```

We could merge _validate_dt64_dtype into this really easily by changing these lines to just call `dtype = pandas_dtype(dtype)`, but that would raise on non-existent tz, which current policy allows.

Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

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

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

```diff
@@            Coverage Diff             @@
##           master   #24478      +/-   ##
==========================================
- Coverage   92.32%   92.32%   -0.01%     
==========================================
  Files         166      166              
  Lines       52298    52305       +7     
==========================================
+ Hits        48285    48288       +3     
- Misses       4013     4017       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.74% <100%> (-0.01%)` | :arrow_down: |
| #single | `43.07% <66.66%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24478?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/tile.py](https://codecov.io/gh/pandas-dev/pandas/pull/24478/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS90aWxlLnB5) | `94.82% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24478/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.59% <100%> (-0.67%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24478?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/24478?src=pr&el=footer). Last update [80295f9...999f34f](https://codecov.io/gh/pandas-dev/pandas/pull/24478?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/24478?src=pr&el=h1) Report
> Merging [#24478](https://codecov.io/gh/pandas-dev/pandas/pull/24478?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3f836274d654b0438586cd00d5053864b791bf66?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24478      +/-   ##
==========================================
- Coverage   92.32%   92.31%   -0.01%     
==========================================
  Files         166      166              
  Lines       52328    52335       +7     
==========================================
+ Hits        48310    48313       +3     
- Misses       4018     4022       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.73% <100%> (-0.01%)` | :arrow_down: |
| #single | `43.05% <66.66%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24478?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/tile.py](https://codecov.io/gh/pandas-dev/pandas/pull/24478/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS90aWxlLnB5) | `94.82% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24478/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.77% <100%> (-0.67%)` | :arrow_down: |

------

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

can you merge master
lgtm ping on green.
ping