当前位置: 首页>>代码示例>>Python>>正文


Python Script.docstring方法代码示例

本文整理汇总了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__)
开发者ID:Hylen,项目名称:jedi,代码行数:11,代码来源:test_api_classes.py

示例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', '')
开发者ID:ABob,项目名称:vim,代码行数:21,代码来源:test_classes.py

示例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'''),
        ''
    )
开发者ID:OrangeCrush,项目名称:dotfiles,代码行数:45,代码来源:test_classes.py

示例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__
开发者ID:OrangeCrush,项目名称:dotfiles,代码行数:6,代码来源:test_compiled.py

示例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)
开发者ID:ABob,项目名称:vim,代码行数:5,代码来源:test_classes.py


注:本文中的jedi.Script.docstring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。