예제 #1
0
def test_unknown_definition():
    """Check we process not found error."""

    definitions = anaconda_mode.goto_definitions('''
raise
''', 2, 5, None)

    assert not definitions
def test_unknown_definition():
    """Check we process not found error."""

    definitions = anaconda_mode.goto_definitions('''
raise
''', 2, 5, None)

    assert not definitions
예제 #3
0
def test_goto_definitions():
    """Check goto definitions works."""

    path = abspath('test.py')

    definitions = anaconda_mode.goto_definitions('''
def fn(a, b):
    pass
fn(1, 2)
''', 4, 2, path)

    assert 2 == definitions[0]['line']
    assert 4 == definitions[0]['column']
    assert path == definitions[0]['module-path']
예제 #4
0
def test_goto_definitions():
    """Check goto definitions works."""

    path = abspath("test.py")

    definitions = anaconda_mode.goto_definitions(
        """
def fn(a, b):
    pass
fn(1, 2)
""",
        4,
        2,
        path,
    )

    assert 2 == definitions[0]["line"]
    assert 4 == definitions[0]["column"]
    assert path == definitions[0]["module-path"]
예제 #5
0
def test_goto_definitions():
    """Check goto definitions works."""

    path = abspath('test.py')

    definitions = anaconda_mode.goto_definitions('''
def fn(a, b):
    pass
fn(1, 2)
''', 4, 2, path)

    assert definitions == [{
        'line': 2,
        'column': 0,
        'name': 'fn',
        'description': 'def fn(a, b):',
        'module': 'test',
        'type': 'function',
        'path': path
    }]
예제 #6
0
def test_goto_definitions():
    """Check goto definitions works."""

    path = abspath('test.py')

    definitions = anaconda_mode.goto_definitions(
        '''
def fn(a, b):
    pass
fn(1, 2)
''', 4, 2, path)

    assert definitions == [{
        'line': 2,
        'column': 0,
        'name': 'fn',
        'description': 'def fn(a, b):',
        'module': 'test',
        'type': 'function',
        'path': path
    }]