Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions numpydoc/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,9 @@ def test_cached_property(self):
def test_three_decorators(self):
"""Test method with three decorators."""

async def test_async(self):
"""Test async method."""


class TestValidatorClass:
@pytest.mark.parametrize("invalid_name", ["unknown_mod", "unknown_mod.MyClass"])
Expand Down Expand Up @@ -1903,6 +1906,10 @@ def test_raises_for_invalid_attribute_name(self, invalid_name):
"numpydoc.tests.test_validate.DecoratorClass.test_three_decorators",
getsourcelines(DecoratorClass.test_three_decorators)[-1] + 3,
],
[
"numpydoc.tests.test_validate.DecoratorClass.test_async",
getsourcelines(DecoratorClass.test_async)[-1],
],
],
)
def test_source_file_def_line_with_decorators(self, decorated_obj, def_line):
Expand Down
3 changes: 2 additions & 1 deletion numpydoc/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ def source_file_def_line(self):
def_line = next(
i
for i, x in enumerate(
re.match("^ *(def|class) ", s) for s in sourcelines[0]
re.match(r"^\s*(async\s+)?(?:def|class)\s+", s)
for s in sourcelines[0]
)
if x is not None
)
Expand Down
Loading