-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally make it possible to use auto_import_modules for packages
This means that you can now write 'from gi.repository import Gtk' and Gtk completions work. It also means that other libraries could be used like that for speed or other reasons. Fixes #531
- Loading branch information
1 parent
5b7984c
commit f4aad8b
Showing
5 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import pytest | ||
|
||
from jedi import settings | ||
from jedi.evaluate.compiled import CompiledContextName | ||
|
||
|
||
def test_base_auto_import_modules(monkeypatch, Script): | ||
@pytest.fixture() | ||
def auto_import_json(monkeypatch): | ||
monkeypatch.setattr(settings, 'auto_import_modules', ['json']) | ||
|
||
|
||
def test_base_auto_import_modules(auto_import_json, Script): | ||
loads, = Script('import json; json.loads').goto_definitions() | ||
assert isinstance(loads._name, CompiledContextName) | ||
|
||
|
||
def test_auto_import_modules_imports(auto_import_json, Script): | ||
main, = Script('from json import tool; tool.main').goto_definitions() | ||
assert isinstance(main._name, CompiledContextName) |