forked from VimPlug/jedi
Use the Script fixture more generally
This commit is contained in:
@@ -24,8 +24,12 @@ from ..helpers import TestCase
|
||||
class MixinTestFullName(object):
|
||||
operation = None
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def init(self, Script):
|
||||
self.Script = Script
|
||||
|
||||
def check(self, source, desired):
|
||||
script = jedi.Script(textwrap.dedent(source))
|
||||
script = self.Script(textwrap.dedent(source))
|
||||
definitions = getattr(script, type(self).operation)()
|
||||
for d in definitions:
|
||||
self.assertEqual(d.full_name, desired)
|
||||
@@ -80,25 +84,25 @@ class TestFullDefinedName(TestCase):
|
||||
""", ['os', 'os.path', 'os.path.join', 'os.path'])
|
||||
|
||||
|
||||
def test_sub_module():
|
||||
def test_sub_module(Script):
|
||||
"""
|
||||
``full_name needs to check sys.path to actually find it's real path module
|
||||
path.
|
||||
"""
|
||||
defs = jedi.Script('from jedi.api import classes; classes').goto_definitions()
|
||||
defs = Script('from jedi.api import classes; classes').goto_definitions()
|
||||
assert [d.full_name for d in defs] == ['jedi.api.classes']
|
||||
defs = jedi.Script('import jedi.api; jedi.api').goto_definitions()
|
||||
defs = Script('import jedi.api; jedi.api').goto_definitions()
|
||||
assert [d.full_name for d in defs] == ['jedi.api']
|
||||
|
||||
|
||||
def test_os_path():
|
||||
d, = jedi.Script('from os.path import join').completions()
|
||||
def test_os_path(Script):
|
||||
d, = Script('from os.path import join').completions()
|
||||
assert d.full_name == 'os.path.join'
|
||||
d, = jedi.Script('import os.p').completions()
|
||||
d, = Script('import os.p').completions()
|
||||
assert d.full_name == 'os.path'
|
||||
|
||||
|
||||
def test_os_issues():
|
||||
def test_os_issues(Script):
|
||||
"""Issue #873"""
|
||||
c, = jedi.Script('import os\nos.nt''').completions()
|
||||
c, = Script('import os\nos.nt''').completions()
|
||||
assert c.full_name == 'nt'
|
||||
|
||||
Reference in New Issue
Block a user