fixed position error with test

This commit is contained in:
David Halter
2012-08-31 17:52:07 +02:00
parent 654b845e71
commit 469388d72d
3 changed files with 7 additions and 2 deletions

View File

@@ -182,7 +182,8 @@ def complete(source, line, column, source_path):
try: try:
scopes = _prepare_goto(source, pos, source_path, f, path, True) scopes = _prepare_goto(source, pos, source_path, f, path, True)
except NotFoundError: except NotFoundError:
scope_generator = evaluate.get_names_for_scope(f.parser.user_scope) scope_generator = evaluate.get_names_for_scope(f.parser.user_scope,
pos)
completions = [] completions = []
for dummy, name_list in scope_generator: for dummy, name_list in scope_generator:
completions += name_list completions += name_list

View File

@@ -15,6 +15,10 @@ b = 1; b = ""
#? str() #? str()
b b
# temp should not be accessible before definition
#? []
temp
a = 1 a = 1
temp = b; temp = b;
b = a b = a

View File

@@ -32,7 +32,7 @@ def run_completion_test(correct, source, line_nr, line, path):
return 1 return 1
else: else:
# TODO remove set! duplicates should not be normal # TODO remove set! duplicates should not be normal
comp_str = str(sorted(set([str(c) for c in completions]))) comp_str = str(sorted(set([c.word for c in completions])))
if comp_str != correct: if comp_str != correct:
print('Solution @%s not right, received %s, wanted %s'\ print('Solution @%s not right, received %s, wanted %s'\
% (line_nr - 1, comp_str, correct)) % (line_nr - 1, comp_str, correct))