本文整理汇总了Python中jedi.Script.docstring方法的典型用法代码示例。如果您正苦于以下问题:Python Script.docstring方法的具体用法?Python Script.docstring怎么用?Python Script.docstring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jedi.Script
的用法示例。
在下文中一共展示了Script.docstring方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_completion_docstring
# 需要导入模块: from jedi import Script [as 别名]
# 或者: from jedi.Script import docstring [as 别名]
def test_completion_docstring():
"""
Jedi should follow imports in certain conditions
"""
c = Script('import jedi\njed').completions()[0]
assert c.docstring(fast=False) == cleandoc(jedi_doc)
c = Script('import jedi\njedi.Scr').completions()[0]
assert c.docstring(raw=True, fast=False) == cleandoc(Script.__doc__)
示例2: test_completion_docstring
# 需要导入模块: from jedi import Script [as 别名]
# 或者: from jedi.Script import docstring [as 别名]
def test_completion_docstring():
"""
Jedi should follow imports in certain conditions
"""
def docstr(src, result):
c = Script(src).completions()[0]
assert c.docstring(raw=True, fast=False) == cleandoc(result)
c = Script('import jedi\njed').completions()[0]
assert c.docstring(fast=False) == cleandoc(jedi_doc)
docstr('import jedi\njedi.Scr', cleandoc(Script.__doc__))
docstr('abcd=3;abcd', '')
docstr('"hello"\nabcd=3\nabcd', 'hello')
# It works with a ; as well.
docstr('"hello"\nabcd=3;abcd', 'hello')
# Shouldn't work with a tuple.
docstr('"hello",0\nabcd=3\nabcd', '')
示例3: test_completion_docstring
# 需要导入模块: from jedi import Script [as 别名]
# 或者: from jedi.Script import docstring [as 别名]
def test_completion_docstring():
"""
Jedi should follow imports in certain conditions
"""
def docstr(src, result):
c = Script(src).completions()[0]
assert c.docstring(raw=True, fast=False) == cleandoc(result)
c = Script('import jedi\njed').completions()[0]
assert c.docstring(fast=False) == cleandoc(jedi_doc)
docstr('import jedi\njedi.Scr', cleandoc(Script.__doc__))
docstr('abcd=3;abcd', '')
docstr('"hello"\nabcd=3\nabcd', '')
docstr(dedent('''
def x():
"hello"
0
x'''),
'hello'
)
docstr(dedent('''
def x():
"hello";0
x'''),
'hello'
)
# Shouldn't work with a tuple.
docstr(dedent('''
def x():
"hello",0
x'''),
''
)
# Should also not work if we rename something.
docstr(dedent('''
def x():
"hello"
y = x
y'''),
''
)
示例4: test_time_docstring
# 需要导入模块: from jedi import Script [as 别名]
# 或者: from jedi.Script import docstring [as 别名]
def test_time_docstring():
import time
comp, = Script('import time\ntime.sleep').completions()
assert comp.docstring() == time.sleep.__doc__
示例5: docstr
# 需要导入模块: from jedi import Script [as 别名]
# 或者: from jedi.Script import docstring [as 别名]
def docstr(src, result):
c = Script(src).completions()[0]
assert c.docstring(raw=True, fast=False) == cleandoc(result)