Ejemplo n.º 1
0
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__)
Ejemplo n.º 2
0
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__)
Ejemplo n.º 3
0
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', '')
Ejemplo n.º 4
0
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', '')
Ejemplo n.º 5
0
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'''),
        ''
    )
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'''),
        ''
    )
Ejemplo n.º 7
0
 def docstr(src, result):
     c = Script(src).completions()[0]
     assert c.docstring(raw=True, fast=False) == cleandoc(result)
Ejemplo n.º 8
0
def test_time_docstring():
    import time
    comp, = Script('import time\ntime.sleep').completions()
    assert comp.docstring() == time.sleep.__doc__
Ejemplo n.º 9
0
 def docstr(src, result):
     c = Script(src).completions()[0]
     assert c.docstring(raw=True, fast=False) == cleandoc(result)