Skip to content

Commit

Permalink
Also count functools.cached_property as property
Browse files Browse the repository at this point in the history
  • Loading branch information
TomFryers committed Jun 24, 2021
1 parent 73a372d commit fc8a1d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pydocstyle/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ConfigurationParser:
DEFAULT_MATCH_RE = r'(?!test_).*\.py'
DEFAULT_MATCH_DIR_RE = r'[^\.].*'
DEFAULT_IGNORE_DECORATORS_RE = ''
DEFAULT_PROPERTY_DECORATORS = "property,cached_property"
DEFAULT_PROPERTY_DECORATORS = "property,cached_property,functools.cached_property"
DEFAULT_CONVENTION = conventions.pep257

PROJECT_CONFIG_FILES = (
Expand Down
13 changes: 8 additions & 5 deletions src/tests/test_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ def test_complex_file(test_case):
test_case_file = os.path.join(test_case_dir,
'test_cases',
test_case + '.py')
results = list(check([test_case_file],
select=set(ErrorRegistry.get_error_codes()),
ignore_decorators=re.compile(
'wraps|ignored_decorator'),
property_decorators="property,cached_property"))
results = list(
check(
[test_case_file],
select=set(ErrorRegistry.get_error_codes()),
ignore_decorators=re.compile('wraps|ignored_decorator'),
property_decorators="property,cached_property,functools.cached_property",
)
)
for error in results:
assert isinstance(error, Error)
results = {(e.definition.name, e.message) for e in results}
Expand Down

0 comments on commit fc8a1d4

Please sign in to comment.