Repository: Zeroto521/my-data-toolkit

Issue:
MAINT: Simplify `register_method_factory`
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [x] whatsnew entry

Delete duplicate `wraps` lines


Discussion:
# [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) Report
> Merging [#552](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (55c12ba) into [main](https://codecov.io/gh/Zeroto521/my-data-toolkit/commit/6dbe61b8472fadd7469f838c1dcd542bc14103a0?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (6dbe61b) will **decrease** coverage by `0.00%`.
> The diff coverage is `n/a`.

```diff
@@            Coverage Diff             @@
##             main     #552      +/-   ##
==========================================
- Coverage   99.64%   99.64%   -0.01%     
==========================================
  Files          60       60              
  Lines         844      840       -4     
  Branches       96       96              
==========================================
- Hits          841      837       -4     
  Misses          1        1              
  Partials        2        2              
```


| [Impacted Files](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) | Coverage Δ | |
|---|---|---|
| [dtoolkit/accessor/register.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero#diff-ZHRvb2xraXQvYWNjZXNzb3IvcmVnaXN0ZXIucHk=) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Last update [6dbe61b...55c12ba](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/552?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).


Resolving patch:
diff --git a/dtoolkit/accessor/register.py b/dtoolkit/accessor/register.py
--- a/dtoolkit/accessor/register.py
+++ b/dtoolkit/accessor/register.py
@@ -34,6 +34,7 @@ def register_method_factory(register_accessor):
 
     # based on pandas_flavor/register.py
     def register_accessor_method(method: Callable, name: str):
+        @wraps(method)
         def method_accessor(pd_obj: SeriesOrFrame):
             @wraps(method)
             def wrapper(*args, **kwargs):


Test patch:
diff --git a/test/accessor/test_register.py b/test/accessor/test_register.py
--- a/test/accessor/test_register.py
+++ b/test/accessor/test_register.py
@@ -120,6 +120,7 @@ def test_work(data, name, expected):
 @pytest.mark.parametrize(
     "data, name, attr, expected",
     [
+        # test instance
         (df, "name_or_columns", "__name__", name_or_columns.__name__),
         (df.a, "name_or_columns", "__name__", name_or_columns.__name__),
         (df.index, "name_or_columns", "__name__", name_or_columns.__name__),
@@ -138,6 +139,11 @@ def test_work(data, name, expected):
         (df, "alias_name_or_columns_1", "__doc__", name_or_columns_2.__doc__),
         (df.a, "alias_name_or_columns_1", "__doc__", name_or_columns_2.__doc__),
         (df.index, "alias_name_or_columns_1", "__doc__", name_or_columns_2.__doc__),
+        # test class
+        (pd.DataFrame, "name_or_columns", "__name__", name_or_columns.__name__),
+        (pd.DataFrame, "name_or_columns_1", "__doc__", name_or_columns_1.__doc__),
+        (pd.DataFrame, "alias_name_or_columns", "__name__", name_or_columns_2.__name__),
+        (pd.DataFrame, "alias_name_or_columns_1", "__doc__", name_or_columns_2.__doc__),
     ],
 )
 def test_method_hooked_attr(data, name, attr, expected):