mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
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
20 lines
598 B
Python
20 lines
598 B
Python
import pytest
|
|
|
|
from jedi import settings
|
|
from jedi.evaluate.compiled import CompiledContextName
|
|
|
|
|
|
@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)
|