Publicize jedi.names and add a first test.

This commit is contained in:
Dave Halter
2014-09-08 22:39:47 +02:00
parent be85391321
commit 851717a968
2 changed files with 15 additions and 2 deletions

View File

@@ -37,5 +37,5 @@ good text editor, while still having very good IDE features for Python.
__version__ = '0.8.1-final0'
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

View File

@@ -6,7 +6,7 @@ from inspect import cleandoc
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 TestCase
@@ -192,3 +192,16 @@ def test_type():
"""
for c in Script('import os; os.path.').completions():
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 == ''