home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyos2bin.zip / Lib / test / test_cmath.py < prev    next >
Text File  |  1996-12-20  |  696b  |  36 lines

  1. #! /usr/bin/env python
  2. """ Simple test script for cmathmodule.c
  3.     Roger E. Masse
  4. """
  5. import cmath
  6. from test_support import verbose
  7.  
  8. testdict = {'acos' : 1.0,
  9.         'acosh' : 1.0,
  10.         'asin' : 1.0,
  11.         'asinh' : 1.0,
  12.         'atan' : 0.2,
  13.         'atanh' : 0.2,
  14.         'cos' : 1.0,
  15.         'cosh' : 1.0,
  16.         'exp' : 1.0,
  17.         'log' : 1.0,
  18.         'log10' : 1.0,
  19.         'sin' : 1.0,
  20.         'sinh' : 1.0,
  21.         'sqrt' : 1.0,
  22.         'tan' : 1.0,
  23.         'tanh' : 1.0}
  24.  
  25. for func in testdict.keys():
  26.     f = getattr(cmath, func)
  27.     r = f(testdict[func])
  28.     if verbose:
  29.     print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r))
  30.  
  31. p = cmath.pi
  32. e = cmath.e
  33. if verbose:
  34.     print 'PI = ', abs(p)
  35.     print 'E = ', abs(e)
  36.