fix(python): Fixed nested return + yield call (#190)

This commit is contained in:
Colin Kennedy
2024-08-02 07:30:43 -07:00
committed by GitHub
parent ca214a4f6c
commit f9040ed838
3 changed files with 36 additions and 1 deletions

View File

@@ -110,6 +110,38 @@ describe("python: google_docstrings", function()
assert.equal(expected, result)
end)
it("works with methods + nested function + return", function()
local source = [[
def foo():|cursor|
def bar():|cursor|
return "blah"
yield "asdfsfd"
]]
local expected = [[
def foo():
"""[TODO:description]
Yields:
[TODO:description]
"""
def bar():
"""[TODO:description]
Returns:
[TODO:return]
"""
return "blah"
yield "asdfsfd"
]]
local result = make_google_docstrings(source)
assert.equal(expected, result)
end)
it("works with methods + nested functions", function()
local source = [[
# Reference: https://github.com/danymat/neogen/pull/151