forked from VimPlug/jedi
Param descriptions should not end with a comma.
This commit is contained in:
@@ -544,7 +544,9 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
|||||||
# only show module name
|
# only show module name
|
||||||
d = 'module %s' % self.module_name
|
d = 'module %s' % self.module_name
|
||||||
elif isinstance(d, pr.Param):
|
elif isinstance(d, pr.Param):
|
||||||
d = d.get_code()
|
d = d.get_code().strip()
|
||||||
|
if d.endswith(','):
|
||||||
|
d = d[:-1] # Remove the comma.
|
||||||
else: # ExprStmt
|
else: # ExprStmt
|
||||||
try:
|
try:
|
||||||
first_leaf = d.first_leaf()
|
first_leaf = d.first_leaf()
|
||||||
|
|||||||
@@ -158,6 +158,15 @@ def test_signature_params():
|
|||||||
check(Script(s + '\nbar=foo\nbar').goto_assignments())
|
check(Script(s + '\nbar=foo\nbar').goto_assignments())
|
||||||
|
|
||||||
|
|
||||||
|
def test_param_endings():
|
||||||
|
"""
|
||||||
|
Params should be represented without the comma and whitespace they have
|
||||||
|
around them.
|
||||||
|
"""
|
||||||
|
sig = Script('def x(a, b=5, c=""): pass\n x(').call_signatures()[0]
|
||||||
|
assert [p.description for p in sig.params] == ['a', 'b=5', 'c=""']
|
||||||
|
|
||||||
|
|
||||||
class TestIsDefinition(TestCase):
|
class TestIsDefinition(TestCase):
|
||||||
def _def(self, source, index=-1):
|
def _def(self, source, index=-1):
|
||||||
return names(dedent(source), references=True, all_scopes=True)[index]
|
return names(dedent(source), references=True, all_scopes=True)[index]
|
||||||
|
|||||||
Reference in New Issue
Block a user