1
0
forked from VimPlug/jedi

Better control over docstring generation

This commit is contained in:
Dave Halter
2019-05-05 19:50:52 +02:00
parent d0b0fb3cb3
commit 45a5eee18a
3 changed files with 25 additions and 7 deletions

View File

@@ -35,7 +35,20 @@ def test_class_doc(Script):
class TestClass():
'''Docstring of `TestClass`.'''
TestClass""").goto_definitions()
assert defs[0].docstring() == 'Docstring of `TestClass`.'
expected = 'Docstring of `TestClass`.'
assert defs[0].docstring(raw=True) == expected
assert defs[0].docstring() == 'TestClass()\n\n' + expected
def test_class_doc_with_init(Script):
d, = Script("""
class TestClass():
'''Docstring'''
def __init__(self, foo, bar=3): pass
TestClass""").goto_definitions()
assert d.docstring() == 'TestClass(foo, bar=3)\n\nDocstring'
def test_instance_doc(Script):