Skip to content

Commit 7f87b70

Browse files
committed
Add a test for the docstring clone
1 parent fb9ea67 commit 7f87b70

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_slots.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,23 @@ def f(self):
752752
assert A(11).f == 11
753753

754754

755+
def test_slots_cached_property_has_docstring():
756+
"""
757+
cached_property in slotted class carries its original docstring
758+
"""
759+
760+
@attr.s(slots=True)
761+
class A:
762+
x = attr.ib()
763+
764+
@functools.cached_property
765+
def f(self):
766+
"""What an informative docstring!"""
767+
return self.x
768+
769+
assert A(11).f.__doc__ == "What an informative docstring!"
770+
771+
755772
def test_slots_cached_property_class_does_not_have__dict__():
756773
"""
757774
slotted class with cached property has no __dict__ attribute.

0 commit comments

Comments
 (0)