forked from flypythoncom/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestit.py
More file actions
26 lines (22 loc) · 687 Bytes
/
testit.py
File metadata and controls
26 lines (22 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def testit(func,*nkwargs,**kwargs):
try:
retval = func(*nkwargs,**kwargs)
result = (True,retval)
except Exception,diag:
result = (False,str(diag))
return result
def test():
funcs =(int,long,float)
vals = (1234,12.34,"1234","12.34")
for eachFunc in funcs:
print "_"*20
for eachVal in vals:
retval = testit(eachFunc,eachVal)
if retval[0]:
print "%s(%s)=" % \
(eachFunc.__name__,"eachVal"),retval[1]
else:
print "%s(%s)=FAILED:" %\
(eachFunc.__name__,"eachVal"),retval[1]
if __name__ == "__main__":
test()