fix(python): Fixed nested return + yield call (#190)
This commit is contained in:
@@ -272,6 +272,9 @@ return {
|
|||||||
|
|
||||||
if nodes[i.Return] then
|
if nodes[i.Return] then
|
||||||
validate_direct_returns(nodes, node)
|
validate_direct_returns(nodes, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
if nodes[i.Return] then
|
||||||
validate_bare_returns(nodes)
|
validate_bare_returns(nodes)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ end
|
|||||||
--- with multiple annotation conventions.
|
--- with multiple annotation conventions.
|
||||||
---@tag neogen-changelog
|
---@tag neogen-changelog
|
||||||
---@toc_entry Changes in neogen plugin
|
---@toc_entry Changes in neogen plugin
|
||||||
neogen.version = "2.19.1"
|
neogen.version = "2.19.2"
|
||||||
--minidoc_afterlines_end
|
--minidoc_afterlines_end
|
||||||
|
|
||||||
return neogen
|
return neogen
|
||||||
|
|||||||
@@ -110,6 +110,38 @@ describe("python: google_docstrings", function()
|
|||||||
assert.equal(expected, result)
|
assert.equal(expected, result)
|
||||||
end)
|
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()
|
it("works with methods + nested functions", function()
|
||||||
local source = [[
|
local source = [[
|
||||||
# Reference: https://github.com/danymat/neogen/pull/151
|
# Reference: https://github.com/danymat/neogen/pull/151
|
||||||
|
|||||||
Reference in New Issue
Block a user