Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 87f5007

Browse files
committed
Update to latest, add test for property deleter method.
1 parent d797f3d commit 87f5007

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pep257.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Method(Function):
150150

151151
@property
152152
def is_public(self):
153-
# Check if we are a setter method, and mark as private if so.
153+
# Check if we are a setter/deleter method, and mark as private if so.
154154
for decorator in self.decorators:
155155
if decorator.name.startswith(self.name):
156156
return False

test_decorators.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,13 @@ def test_is_public_setter(self):
230230
]
231231

232232
assert not method.is_public
233+
234+
def test_is_public_deleter(self):
235+
"""Deleter methods are also considered private."""
236+
method = self.makeMethod('methodName')
237+
method.decorators = [
238+
pep257.Decorator('methodName.deleter', []),
239+
pep257.Decorator('another_decorator', []),
240+
]
241+
242+
assert not method.is_public

0 commit comments

Comments
 (0)