Check boundary undefined with non-default close parameter for DatetimeIndex #23198
State: closed

- [X] closes #23198 
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Datetime
description: Datetime data dtype
name: Error Reporting
description: Incorrect or improved errors from pandas

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

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


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

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

```diff
@@            Coverage Diff             @@
##           master   #23199      +/-   ##
==========================================
+ Coverage   92.19%   92.19%   +<.01%     
==========================================
  Files         169      169              
  Lines       50956    50956              
==========================================
+ Hits        46977    46978       +1     
+ Misses       3979     3978       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <100%> (ø)` | :arrow_up: |
| #single | `42.27% <100%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23199?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23199/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.61% <100%> (+0.23%)` | :arrow_up: |

------

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

No idea what happened with the failed test.
The failed test is unrelated; don't worry about it.

This does need its own test though.
I have no previous experience with pytest, I guess I need to add a new method to the `TestDatetimeArray` class [here](https://github.com/Adirio/pandas/blob/patch-1/pandas/tests/arrays/test_datetimelike.py#L48) that checks that a `ValueError` is raised if `closed != None` while one of the boundaries is not given, but no idea how to check that.
You can use the `pytest.raises` context manager and see if the examples in the linked issue will raise a `ValueError`:

```
with pytest.raises(ValueError):
    pd.date_range(...)
```
this would need to assert all of the test cases in the OP
can you merge master and update.
closing as stale. ping if you'd like to continue.
@jreback I can merge master if you wish but I can not provide the requested tests right now.