コード例 #1
0
def test_unknown_definition():
    """Check we process not found error."""

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

    assert not definitions
コード例 #2
0
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
    }]