added import tests

This commit is contained in:
David Halter
2012-04-21 23:08:13 +02:00
parent dccef451a2
commit 1af8273389
6 changed files with 31 additions and 11 deletions

View File

@@ -1,4 +1,22 @@
# -----------------
# std lib modules
# -----------------
import tokenize
#? ['tok_name']
tokenize.tok_name
from pyclbr import *
#? ['readmodule_ex']
readmodule_ex
import os
#? ['dirname']
os.path.dirname
# -----------------
# builtins
# -----------------
import sys
#? ['prefix']
@@ -7,14 +25,13 @@ sys.prefix
#? ['append']
sys.path.append
# --- builtin math ---
from math import *
#? ['cos', 'cosh']
cos
import os
def func_with_import():
import time
return time
#? ['dirname']
os.path.dirname
#? ['sleep']
func_with_import().sleep

View File

@@ -39,11 +39,12 @@ def completion_test(source):
print traceback.format_exc()
fails += 1
else:
# TODO remove sorted? completions should be sorted
# TODO remove sorted? completions should be sorted?
comp_str = str(sorted([str(c) for c in completions]))
if comp_str != correct:
print 'Solution not correct, received %s, wanted %s' % \
(comp_str, correct)
#print [(c.name, c.name.parent) for c in completions]
fails += 1
correct = None
tests += 1