diff --git a/jedi/__init__.py b/jedi/__init__.py index a8439f8c..0bc8e302 100644 --- a/jedi/__init__.py +++ b/jedi/__init__.py @@ -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 diff --git a/test/test_api/test_api_classes.py b/test/test_api/test_api_classes.py index 29dafb5a..b96a37c2 100644 --- a/test/test_api/test_api_classes.py +++ b/test/test_api/test_api_classes.py @@ -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 == ''