goto follows now also import statements

This commit is contained in:
David Halter
2012-07-28 18:28:38 +02:00
parent deb2426e44
commit e99ff5528e
5 changed files with 15 additions and 7 deletions

View File

@@ -113,10 +113,15 @@ def run_goto_test(correct, source, line_nr, line, path):
r = r.definition
if isinstance(r, evaluate.InstanceElement):
r = r.var
if isinstance(r, evaluate.parsing.Name):
r = r.parent
if isinstance(r, (evaluate.Class, evaluate.Instance)):
r = 'class ' + str(r.name)
elif isinstance(r, (evaluate.Function, evaluate.parsing.Function)):
r = 'def ' + str(r.name)
elif isinstance(r, evaluate.parsing.Module):
r = 'module ' + str(r.path)
else:
r = r.get_code().replace('\n', '')
lst.append(r)
@@ -124,7 +129,6 @@ def run_goto_test(correct, source, line_nr, line, path):
if comp_str != correct:
print('Solution @%s not right, received %s, wanted %s'\
% (line_nr - 1, comp_str, correct))
print result
return 1
return 0