New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added general unittest + Python unittests #174
base: main
Are you sure you want to change the base?
Added general unittest + Python unittests #174
Conversation
dd03c31
to
fa4362e
Compare
Hello @ColinKennedy, thanks a lot for your PR proposal for the testing suites. Indeed, that will help a lot finding some edgy bugs, and making sure that everything passes before merging (and does not break anything). I still need to review it, but as soon as i get the time, i take this into matter. Anyways, can you explain a bit more (as i don't get the time to review atm) what the |
Sure thing. it("works with methods + nested functions", function()
local source = [[
# Reference: https://github.com/danymat/neogen/pull/151
class Thing(object):
def foo(self, bar, fizz, buzz):|cursor|
def another(inner, function):|cursor|
def inner_most(more, stuff):|cursor|
pass
]]
local expected = [[
# Reference: https://github.com/danymat/neogen/pull/151
class Thing(object):
def foo(self, bar, fizz, buzz):
"""[TODO:description]
Args:
bar ([TODO:parameter]): [TODO:description]
fizz ([TODO:parameter]): [TODO:description]
buzz ([TODO:parameter]): [TODO:description]
"""
def another(inner, function):
"""[TODO:description]
Args:
inner ([TODO:parameter]): [TODO:description]
function ([TODO:parameter]): [TODO:description]
"""
def inner_most(more, stuff):
"""[TODO:description]
Args:
more ([TODO:parameter]): [TODO:description]
stuff ([TODO:parameter]): [TODO:description]
"""
pass
]]
local result = _make_python_docstring(source)
assert.equal(expected, result)
end) As a person writing unittests, I want to be able to
In the example above, |
fa4362e
to
b087072
Compare
Added minor version bump to 2.18.0
b087072
to
9e94d63
Compare
Closes: #173
Added plenary (busted-style lua tests). Also added about as many Python unittests as I could think of for now. Note that these tests uncovered several bugs. Just searching
-- TODO:
through this PR's diff will point them out. The worst so far is the "inline comment" bug where if you add an inline comment on the same line as the function you're trying to document, the generated docstring accidentally positions itself above the function and heavily indented. But that can be for another GitHub issue.Anyway, I think this will do the repo a lot of good. People can of course add docstrings for their language + docstring style of choice. I added Python + Google style since that's my daily driver. What do you think?
P.S. I was hoping to run unittests on Neovim version 0.9 (currently
stable
) but it was failing on neogen.generate. Did Neogen change to be a "requires nightly" repository?)