STY: use pytest.raises context manager (indexes/period)
State: closed

xref #24332

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Code Style
description: Code style, linting, code_checks

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

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

```diff
@@           Coverage Diff           @@
##           master   #25199   +/-   ##
=======================================
  Coverage   92.35%   92.35%           
=======================================
  Files         166      166           
  Lines       52314    52314           
=======================================
  Hits        48312    48312           
  Misses       4002     4002
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.78% <ø> (ø)` | :arrow_up: |
| #single | `42.84% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25199?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/25199?src=pr&el=footer). Last update [638ddeb...7026236](https://codecov.io/gh/pandas-dev/pandas/pull/25199?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/25199?src=pr&el=h1) Report
> Merging [#25199](https://codecov.io/gh/pandas-dev/pandas/pull/25199?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/638ddebaa7da1e569836a5b89593b120dbbf491c?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #25199   +/-   ##
=======================================
  Coverage   92.35%   92.35%           
=======================================
  Files         166      166           
  Lines       52314    52314           
=======================================
  Hits        48312    48312           
  Misses       4002     4002
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.78% <ø> (ø)` | :arrow_up: |
| #single | `42.84% <ø> (ø)` | :arrow_up: |


------

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

thanks @simonjayhawkins