Fix keyword docstring

This commit is contained in:
micbou
2017-07-12 21:34:39 +02:00
committed by Dave Halter
parent 9fb7fb66da
commit f5248250d8
2 changed files with 14 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ class TestDocstring(unittest.TestCase):
def func():
'''Docstring of `func`.'''
func""").goto_definitions()
self.assertEqual(defs[0].raw_doc, 'Docstring of `func`.')
self.assertEqual(defs[0].docstring(), 'func()\n\nDocstring of `func`.')
@unittest.skip('need evaluator class for that')
def test_attribute_docstring(self):
@@ -28,7 +28,7 @@ class TestDocstring(unittest.TestCase):
x = None
'''Docstring of `x`.'''
x""").goto_definitions()
self.assertEqual(defs[0].raw_doc, 'Docstring of `x`.')
self.assertEqual(defs[0].docstring(), 'Docstring of `x`.')
@unittest.skip('need evaluator class for that')
def test_multiple_docstrings(self):
@@ -38,7 +38,7 @@ class TestDocstring(unittest.TestCase):
x = func
'''Docstring of `x`.'''
x""").goto_definitions()
docs = [d.raw_doc for d in defs]
docs = [d.docstring() for d in defs]
self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.'])
def test_completion(self):
@@ -105,6 +105,10 @@ class TestDocstring(unittest.TestCase):
assert '__init__' in names
assert 'mro' not in names # Exists only for types.
def test_docstring_keyword(self):
completions = jedi.Script('assert').completions()
self.assertIn('assert', completions[0].docstring())
@unittest.skipIf(numpydoc_unavailable, 'numpydoc module is unavailable')
def test_numpydoc_docstring(self):
s = dedent('''