Home | History | Annotate | Download | only in test

Lines Matching defs:cmath

4 import cmath, math
5 from cmath import phase, polar, rect, pi
49 # list of all functions in cmath
50 test_functions = [getattr(cmath, fname) for fname in [
55 test_functions.append(lambda x : cmath.log(x, 1729. + 0j))
56 test_functions.append(lambda x : cmath.log(14.-27j, x))
117 self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
118 msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
119 self.assertAlmostEqual(cmath.e, e_expected, places=9,
120 msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
123 # Test automatic calling of __complex__ and __float__ by cmath
127 # for which any of the functions in cmath is undefined
138 # end up being passed to the cmath functions
224 # ints and longs should be acceptable inputs to all cmath
236 # check that corresponding cmath and math functions are equal
270 complex_fn = getattr(cmath, fn)
279 z = cmath.log(v, base)
290 return cmath.rect(z.real, z.imag)
305 function = getattr(cmath, fn)
448 self.assertFalse(cmath.isnan(1))
449 self.assertFalse(cmath.isnan(1j))
450 self.assertFalse(cmath.isnan(INF))
451 self.assertTrue(cmath.isnan(NAN))
452 self.assertTrue(cmath.isnan(complex(NAN, 0)))
453 self.assertTrue(cmath.isnan(complex(0, NAN)))
454 self.assertTrue(cmath.isnan(complex(NAN, NAN)))
455 self.assertTrue(cmath.isnan(complex(NAN, INF)))
456 self.assertTrue(cmath.isnan(complex(INF, NAN)))
459 self.assertFalse(cmath.isinf(1))
460 self.assertFalse(cmath.isinf(1j))
461 self.assertFalse(cmath.isinf(NAN))
462 self.assertTrue(cmath.isinf(INF))
463 self.assertTrue(cmath.isinf(complex(INF, 0)))
464 self.assertTrue(cmath.isinf(complex(0, INF)))
465 self.assertTrue(cmath.isinf(complex(INF, INF)))
466 self.assertTrue(cmath.isinf(complex(NAN, INF)))
467 self.assertTrue(cmath.isinf(complex(INF, NAN)))