Files
jedi/test/evaluate/test_imports.py
2014-01-29 20:43:42 +01:00

27 lines
744 B
Python

import pytest
import jedi
from jedi._compatibility import find_module_py33
from ..helpers import cwd_at
@pytest.mark.skipif('sys.version_info < (3,3)')
def test_find_module_py33():
"""Needs to work like the old find_module."""
print(find_module_py33('_io'))
assert find_module_py33('_io') == (None, '_io', False)
@cwd_at('test/not_in_sys_path/pkg')
def test_import_not_in_sys_path():
"""
non-direct imports (not in sys.path)
"""
a = jedi.Script(path='module.py', line=5).goto_definitions()
assert a[0].name == 'int'
a = jedi.Script(path='module.py', line=6).goto_definitions()
assert a[0].name == 'str'
a = jedi.Script(path='module.py', line=7).goto_definitions()
assert a[0].name == 'str'