COMPAT: Fix indent level bug preventing wrapper function rename
State: closed

Original code intends to rename the wrapper function f using the provided name, but this isn't happening because code is incorrectly indented an extra level.
```python
Example:
>>> from pandas.core.groupby import GroupBy
>>> GroupBy.sum.__name__
'f'
```

Should be 'sum'.

Labels:
name: Bug
name: Groupby
name: API Design

Comments:
can u add some tests for this (and validate all functions names in the whitelist would be great)

@jreback, tried adding a test for all whitelist function names and discovered there are additional places where attribute and method names are inconsistent. Replaced that with a test that only covers the names corresponding to this current bug fix. If you think it makes sense to hold off until all whitelist function names are properly handled then I can close this PR for now and open an issue.

just make it 2. tests
1 for good ones
1 for failing ones
then can add a TODO for the failing ones

@jreback, added back failing test, commented out, and marked w/ TODO. Does reuse a an existing test to prevent duplicating whitelists or refactoring them to be class members. Let me know if you had something else in mind.

@jreback, revised test to show things in whitelist that currently fail. Test now also handles all of the other whitelist cases that aren't known issues.

@jreback, created the additional test to assert that method `__name__` is inconsistent with attribute name for these known issues. Also revised the comment explaining the inconsistencies.

@matthagy can you rebase / update.

sorry got a bit lost in the shuffle.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=h1) Report
> Merging [#14620](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ec84ae3d6f73633aee5058148ea76fdd79f74ac4?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `93.87%`.

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

```diff
@@            Coverage Diff             @@
##           master   #14620      +/-   ##
==========================================
- Coverage   90.99%   90.98%   -0.02%     
==========================================
  Files         143      143              
  Lines       49420    49403      -17     
==========================================
- Hits        44972    44949      -23     
- Misses       4448     4454       +6
```


| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `95.03% <93.87%> (+0.05%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/types/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL3R5cGVzL2Nhc3QucHk=) | `85.31% <0%> (-0.29%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.56% <0%> (-0.11%)` | :arrow_down: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `95.48% <0%> (-0.03%)` | :arrow_down: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.51% <0%> (-0.01%)` | :arrow_down: |
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `79.67% <0%> (ø)` | :arrow_up: |
| [pandas/core/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbWlzc2luZy5weQ==) | `84.9% <0%> (+0.62%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/14620?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/14620?src=pr&el=footer). Last update [ec84ae3...db3c6e4](https://codecov.io/gh/pandas-dev/pandas/pull/14620?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
@jreback, rebased.
can you rebase?
@jreback, rebased.
thanks @matthagy 
lgtm. ping on green.
can you rebase / update
@matthagy can you rebase / ping on green.
@matthagy I pushed a change here to make this also set ``__qualname__`` (we do this already all Series/DataFrame anyhow, so seemed easy to add here.

Can you push a whatsnew note, otherwise this lgtm. I think you had several TODO's in the tests for functions which don't set things properly, can you have a look at those?
cc @mrocklin