From a9bf06987a1d9d00a653b5d0773fedad1ea16b0b Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 19 May 2013 21:12:37 +0430 Subject: [PATCH] completion on empty import problem --- jedi/imports.py | 2 +- test/test_regression.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jedi/imports.py b/jedi/imports.py index 81669ba1..b0d6c5a7 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -162,9 +162,9 @@ class ImportPath(pr.Base): # If you edit e.g. gunicorn, there will be imports like this: # `from gunicorn import something`. But gunicorn is not in the # sys.path. Therefore look if gunicorn is a parent directory, #56. - parts = self.file_path.split(os.path.sep) in_path = [] if self.import_path: + parts = self.file_path.split(os.path.sep) for i, p in enumerate(parts): if p == self.import_path[0]: new = os.path.sep.join(parts[:i]) diff --git a/test/test_regression.py b/test/test_regression.py index 7ed276ac..04369bf0 100755 --- a/test/test_regression.py +++ b/test/test_regression.py @@ -324,6 +324,8 @@ class TestRegression(TestBase): # unrelated to #44 defs = self.goto_assignments("import") assert len(defs) == 0 + completions = self.completions("import", (1,1)) + assert len(completions) == 0 def test_goto_following_on_imports(self): s = "import multiprocessing.dummy; multiprocessing.dummy"