diff --git a/test/test_cache.py b/test/test_cache.py index d94a78e0..79bdefca 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -2,15 +2,13 @@ Test all things related to the ``jedi.cache`` module. """ -import jedi - -def test_cache_call_signatures(): +def test_cache_call_signatures(Script): """ See github issue #390. """ def check(column, call_name, path=None): - assert jedi.Script(s, 1, column, path).call_signatures()[0].name == call_name + assert Script(s, 1, column, path).call_signatures()[0].name == call_name s = 'str(int())' @@ -26,6 +24,6 @@ def test_cache_call_signatures(): check(4, 'str', 'boo') -def test_cache_line_split_issues(): +def test_cache_line_split_issues(Script): """Should still work even if there's a newline.""" - assert jedi.Script('int(\n').call_signatures()[0].name == 'int' + assert Script('int(\n').call_signatures()[0].name == 'int' diff --git a/test/test_integration_keyword.py b/test/test_integration_keyword.py index 9ed6d20c..7612d68e 100644 --- a/test/test_integration_keyword.py +++ b/test/test_integration_keyword.py @@ -2,10 +2,9 @@ Test of keywords and ``jedi.keywords`` """ from jedi._compatibility import is_py3 -from jedi import Script -def test_goto_assignments_keyword(): +def test_goto_assignments_keyword(Script): """ Bug: goto assignments on ``in`` used to raise AttributeError:: @@ -14,7 +13,7 @@ def test_goto_assignments_keyword(): Script('in').goto_assignments() -def test_keyword(): +def test_keyword(Script): """ github jedi-vim issue #44 """ defs = Script("print").goto_definitions() if is_py3: diff --git a/test/test_speed.py b/test/test_speed.py index dac98ac0..afd3e5a3 100644 --- a/test/test_speed.py +++ b/test/test_speed.py @@ -31,29 +31,29 @@ def _check_speed(time_per_run, number=4, run_warm=True): @_check_speed(0.2) -def test_os_path_join(): +def test_os_path_join(Script): s = "from posixpath import join; join('', '')." - assert len(jedi.Script(s).completions()) > 10 # is a str completion + assert len(Script(s).completions()) > 10 # is a str completion @_check_speed(0.15) -def test_scipy_speed(): +def test_scipy_speed(Script): s = 'import scipy.weave; scipy.weave.inline(' - script = jedi.Script(s, 1, len(s), '') + script = Script(s, 1, len(s), '') script.call_signatures() #print(jedi.imports.imports_processed) @_check_speed(0.8) @cwd_at('test') -def test_precedence_slowdown(): +def test_precedence_slowdown(Script): """ Precedence calculation can slow down things significantly in edge cases. Having strange recursion structures increases the problem. """ with open('speed/precedence.py') as f: line = len(f.read().splitlines()) - assert jedi.Script(line=line, path='speed/precedence.py').goto_definitions() + assert Script(line=line, path='speed/precedence.py').goto_definitions() @_check_speed(0.1)