mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Publicize jedi.names and add a first test.
This commit is contained in:
@@ -37,5 +37,5 @@ good text editor, while still having very good IDE features for Python.
|
|||||||
__version__ = '0.8.1-final0'
|
__version__ = '0.8.1-final0'
|
||||||
|
|
||||||
from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
|
from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
|
||||||
from jedi.api import preload_module, defined_names
|
from jedi.api import preload_module, defined_names, names
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from inspect import cleandoc
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from jedi import Script, defined_names, __doc__ as jedi_doc
|
from jedi import Script, defined_names, __doc__ as jedi_doc, names
|
||||||
from ..helpers import cwd_at
|
from ..helpers import cwd_at
|
||||||
from ..helpers import TestCase
|
from ..helpers import TestCase
|
||||||
|
|
||||||
@@ -192,3 +192,16 @@ def test_type():
|
|||||||
"""
|
"""
|
||||||
for c in Script('import os; os.path.').completions():
|
for c in Script('import os; os.path.').completions():
|
||||||
assert c.type
|
assert c.type
|
||||||
|
|
||||||
|
|
||||||
|
class TestGotoAssignments(TestCase):
|
||||||
|
"""
|
||||||
|
This tests the BaseDefinition.goto_assignments function, not the jedi
|
||||||
|
function. They are not really different in functionality, but really
|
||||||
|
different as an implementation.
|
||||||
|
"""
|
||||||
|
def test_basic(self):
|
||||||
|
refs = names('a = 1; a', references=True, definitions=False)
|
||||||
|
assert len(refs) == 1
|
||||||
|
ass = refs[0].goto_assignments()
|
||||||
|
assert ass[0].description == ''
|
||||||
|
|||||||
Reference in New Issue
Block a user