From 1a5942364a6c47a221d0e4e8c008ead1685a1e33 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Tue, 21 May 2013 17:16:40 +0200 Subject: [PATCH 1/2] Add failing tests for first part of #213 --- test/completion/imports.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/completion/imports.py b/test/completion/imports.py index 83a4a721..d62a47c7 100644 --- a/test/completion/imports.py +++ b/test/completion/imports.py @@ -72,6 +72,16 @@ import os #? ['dirname'] os.path.dirname +#? os.path.join +from os.path import join + +from os.path import ( + expanduser +) + +#? os.path.expanduser +expanduser + from itertools import (tee, islice) #? ['islice'] From 46ac76e8be2a7c85b8ae8cdee0d151c7ec59e950 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Tue, 21 May 2013 17:40:20 +0200 Subject: [PATCH 2/2] Reproduce the previous test failure w/o stdlib It turned out that the failure occurs when you define "fake module path" by importing some module from others. Indeed, this is what happens in os.py. --- test/completion/import_tree/mod2.py | 1 + test/completion/imports.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/completion/import_tree/mod2.py diff --git a/test/completion/import_tree/mod2.py b/test/completion/import_tree/mod2.py new file mode 100644 index 00000000..19914f58 --- /dev/null +++ b/test/completion/import_tree/mod2.py @@ -0,0 +1 @@ +from . import mod1 as fake diff --git a/test/completion/imports.py b/test/completion/imports.py index d62a47c7..8ba0d9b1 100644 --- a/test/completion/imports.py +++ b/test/completion/imports.py @@ -56,6 +56,27 @@ def scope_nested(): #? set import_tree.random.a +def scope_from_import_variable(): + #? int() + from import_tree.mod2.fake import a + #? set + from import_tree.mod2.fake import c + + #? int() + a + #? set + c + +def scope_from_import_variable_with_parenthesis(): + from import_tree.mod2.fake import ( + a, c + ) + + #? int() + a + #? set + c + # ----------------- # std lib modules # ----------------- @@ -206,7 +227,7 @@ import datetime. #? [] import datetime.date -#? 18 ['mod1', 'random', 'pkg', 'rename1', 'rename2', 'import'] +#? 18 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'import'] from import_tree. import pkg #? 18 ['pkg']