1
0
forked from VimPlug/jedi

deprecate 'source_path' as a Script parameter in favour of 'path'

This commit is contained in:
David Halter
2013-08-15 19:25:19 +04:30
parent 98fc11ecfd
commit fbcecaf1ef
6 changed files with 33 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ el.description
scopes, path, dot, like = \
api._prepare_goto(source, row, column, source_path, True)
api._prepare_goto(source, row, column, path, True)
# has problems with that (sometimes) very deep nesting.
#? set()

View File

@@ -178,7 +178,7 @@ class IntegrationTestCase(object):
return should_str
script = self.script()
should_str = definition(self.correct, self.start, script.source_path)
should_str = definition(self.correct, self.start, script.path)
result = script.goto_definitions()
is_str = set(r.desc_with_module for r in result)
return compare_cb(self, is_str, should_str)

View File

@@ -17,11 +17,11 @@ def test_goto_definition_on_import():
@cwd_at('jedi')
def test_complete_on_empty_import():
# should just list the files in the directory
assert 10 < len(Script("from .", source_path='').completions()) < 30
assert 10 < len(Script("from .", path='').completions()) < 30
assert 10 < len(Script("from . import", 1, 5, '').completions()) < 30
assert 10 < len(Script("from . import classes", 1, 5, '').completions()) < 30
assert len(Script("import").completions()) == 0
assert len(Script("import import", source_path='').completions()) > 0
assert len(Script("import import", path='').completions()) > 0
# 111
assert Script("from datetime import").completions()[0].name == 'import'
@@ -32,11 +32,11 @@ def test_imports_on_global_namespace_without_path():
"""If the path is None, there shouldn't be any import problem"""
completions = Script("import operator").completions()
assert [c.name for c in completions] == ['operator']
completions = Script("import operator", source_path= 'example.py').completions()
completions = Script("import operator", path= 'example.py').completions()
assert [c.name for c in completions] == ['operator']
# the first one has a path the second doesn't
completions = Script("import keyword", source_path='example.py').completions()
completions = Script("import keyword", path='example.py').completions()
assert [c.name for c in completions] == ['keyword']
completions = Script("import keyword").completions()
assert [c.name for c in completions] == ['keyword']

View File

@@ -81,7 +81,7 @@ class TestRegression(TestCase):
src2 = 'from .. import setup; setup.ret(1)'
# .parser to load the module
api.modules.Module(os.path.abspath('dynamic.py'), src2).parser
result = Script(src1, source_path='../setup.py').goto_definitions()
result = Script(src1, path='../setup.py').goto_definitions()
assert len(result) == 1
assert result[0].description == 'class int'