diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-26 09:30:44 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-26 09:30:44 +0300 |
commit | ad9105e1abd5403cd0c4121bfd388a54a782e946 (patch) | |
tree | 891a0f4b88145738c4c139cb3a0697df0b5652a0 /Lib/test/test_reprlib.py | |
parent | f5627430fe4e98accbe44d7d9936dc94c161a48c (diff) | |
download | cpython-ad9105e1abd5403cd0c4121bfd388a54a782e946.tar.gz |
Issue #26634: recursive_repr() now sets __qualname__ of wrapper.
Patch by Xiang Zhang.
Diffstat (limited to 'Lib/test/test_reprlib.py')
-rw-r--r-- | Lib/test/test_reprlib.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py index a51c4d7523..4bf91945ea 100644 --- a/Lib/test/test_reprlib.py +++ b/Lib/test/test_reprlib.py @@ -374,6 +374,13 @@ class MyContainer2(MyContainer): def __repr__(self): return '<' + ', '.join(map(str, self.values)) + '>' +class MyContainer3: + def __repr__(self): + 'Test document content' + pass + wrapped = __repr__ + wrapper = recursive_repr()(wrapped) + class TestRecursiveRepr(unittest.TestCase): def test_recursive_repr(self): m = MyContainer(list('abcde')) @@ -387,5 +394,12 @@ class TestRecursiveRepr(unittest.TestCase): m.append(m) self.assertEqual(repr(m), '<a, b, c, d, e, +++, x, +++>') + def test_assigned_attributes(self): + from functools import WRAPPER_ASSIGNMENTS as assigned + wrapped = MyContainer3.wrapped + wrapper = MyContainer3.wrapper + for name in assigned: + self.assertIs(getattr(wrapper, name), getattr(wrapped, name)) + if __name__ == "__main__": unittest.main() |