| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ def wrapper(self): | |||
| 30 | 30 | wrapper.__module__ = getattr(user_function, '__module__') | |
| 31 | 31 | wrapper.__doc__ = getattr(user_function, '__doc__') | |
| 32 | 32 | wrapper.__name__ = getattr(user_function, '__name__') | |
| 33 | + wrapper.__qualname__ = getattr(user_function, '__qualname__') | ||
| 33 | 34 | wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) | |
| 34 | 35 | return wrapper | |
| 35 | 36 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -374,6 +374,13 @@ class MyContainer2(MyContainer): | |||
| 374 | 374 | def __repr__(self): | |
| 375 | 375 | return '<' + ', '.join(map(str, self.values)) + '>' | |
| 376 | 376 | ||
| 377 | + class MyContainer3: | ||
| 378 | + def __repr__(self): | ||
| 379 | + 'Test document content' | ||
| 380 | + pass | ||
| 381 | + wrapped = __repr__ | ||
| 382 | + wrapper = recursive_repr()(wrapped) | ||
| 383 | + | ||
| 377 | 384 | class TestRecursiveRepr(unittest.TestCase): | |
| 378 | 385 | def test_recursive_repr(self): | |
| 379 | 386 | m = MyContainer(list('abcde')) | |
@@ -387,5 +394,12 @@ def test_recursive_repr(self): | |||
| 387 | 394 | m.append(m) | |
| 388 | 395 | self.assertEqual(repr(m), '<a, b, c, d, e, +++, x, +++>') | |
| 389 | 396 | ||
| 397 | + def test_assigned_attributes(self): | ||
| 398 | + from functools import WRAPPER_ASSIGNMENTS as assigned | ||
| 399 | + wrapped = MyContainer3.wrapped | ||
| 400 | + wrapper = MyContainer3.wrapper | ||
| 401 | + for name in assigned: | ||
| 402 | + self.assertIs(getattr(wrapper, name), getattr(wrapped, name)) | ||
| 403 | + | ||
| 390 | 404 | if __name__ == "__main__": | |
| 391 | 405 | unittest.main() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,6 +107,9 @@ Core and Builtins | |||
| 107 | 107 | Library | |
| 108 | 108 | ------- | |
| 109 | 109 | ||
| 110 | + - Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by | ||
| 111 | + Xiang Zhang. | ||
| 112 | + | ||
| 110 | 113 | - Issue #26804: urllib.request will prefer lower_case proxy environment | |
| 111 | 114 | variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter | |
| 112 | 115 | Jansen. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments