#!/usr/bin/env python

def testit(func, *nkwargs, **kwargs):

   try:
       retval = apply(func, nkwargs, kwargs)
       result = (1, retval)
   except Exception, diag:
       result = (0, 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()
