MAINT: Rename assertRaisesRegexp to assert_raises_regex
State: closed

Title is self-explanatory.

xref <a href="https://github.com/pandas-dev/pandas/pull/16089#issuecomment-296327919">#16089 (comment)</a>

Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
``assert_raises_regex`` is a bit shorter
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=h1) Report
> Merging [#16119](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d50b1620ca57a37c0c005ae946b9fc45020e2155?src=pr&el=desc) will **increase** coverage by `0.02%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #16119      +/-   ##
==========================================
+ Coverage   90.84%   90.86%   +0.02%     
==========================================
  Files         159      159              
  Lines       50779    50779              
==========================================
+ Hits        46128    46141      +13     
+ Misses       4651     4638      -13
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.64% <100%> (+0.02%)` | :arrow_up: |
| #single | `40.33% <100%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `79.07% <100%> (ø)` | :arrow_up: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `91.03% <0%> (+0.34%)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/16119?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.35% <0%> (+1.81%)` | :arrow_up: |

------

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

I was thinking the "with" makes the name a little clearer (from a grammatical perspective especially).  What do you think?
```
with tm.assert_raises_with_regex(
                 ValueError, "\"mysin\" is not a supported function"):
```

This is much more clear (and not redundant).
```
with tm.assert_raises_regex(
                 ValueError, "\"mysin\" is not a supported function"):
```
Fair enough.  Done.
@jreback : It would be great to get this merged in ASAP, since every time `master` gets updated, I have to rebase (like I have to now) to ensure that there are no merge conflicts + no new `assertRaisesRegexp` have been used.
yes, sorry, busy with some other things.

thanks @gfyoung 
@jreback : No worries, but FYI, `master` is going to break because I was just going to remove the remain `assertRaisesRegexp` from the latest commits before you merged.
@jreback : Putting up PR right now to patch this immediately.
yep