1
0
forked from VimPlug/jedi

import jedi in tests and not api

This commit is contained in:
David Halter
2013-01-08 12:15:50 +01:00
parent 35186629f0
commit 3c4e079ecb
4 changed files with 31 additions and 29 deletions

View File

@@ -6,10 +6,10 @@ import traceback
import base
from _compatibility import unicode, StringIO, reduce, literal_eval, is_py25
from jedi._compatibility import unicode, StringIO, reduce, literal_eval, is_py25
import api
import debug
import jedi
from jedi import debug
sys.path.pop(0) # pop again, because it might affect the completion
@@ -122,7 +122,7 @@ def run_test(source, f_name, lines_to_execute):
"""
def get_defs(correct, correct_start, path):
def defs(line_nr, indent):
script = api.Script(source, line_nr, indent, path)
script = jedi.Script(source, line_nr, indent, path)
return set(script.get_definition())
should_be = set()
@@ -133,7 +133,7 @@ def run_test(source, f_name, lines_to_execute):
# -1 for the comment, +3 because of the comment start `#? `
start = index.start()
if base.print_debug:
api.set_debug_function(None)
jedi.set_debug_function(None)
number += 1
try:
should_be |= defs(line_nr - 1, start + correct_start)
@@ -141,7 +141,7 @@ def run_test(source, f_name, lines_to_execute):
print('could not resolve %s indent %s' % (line_nr - 1, start))
raise
if base.print_debug:
api.set_debug_function(debug.print_to_stdout)
jedi.set_debug_function(debug.print_to_stdout)
# because the objects have different ids, `repr` it, then compare it.
should_str = set(r.desc_with_module for r in should_be)
if len(should_str) < number:
@@ -169,7 +169,7 @@ def run_test(source, f_name, lines_to_execute):
# get_definition test
path = completion_test_dir + os.path.sep + f_name
try:
script = api.Script(source, line_nr, index, path)
script = jedi.Script(source, line_nr, index, path)
if test_type == '!':
fails += run_goto_test(script, correct, line_nr)
elif test_type == '<':