]> granicus.if.org Git - python/commitdiff
Adds tests for degrees() and radians() functions added to mathmodule.
authorRaymond Hettinger <python@rcn.com>
Mon, 13 May 2002 03:55:01 +0000 (03:55 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 13 May 2002 03:55:01 +0000 (03:55 +0000)
Closes patch 552452 and feature request 426539.

Lib/test/test_math.py

index 743d46b3b4935d3590ff5af69f3a446e9fe51c56..cb2b86cd898d7297987fd385b0d15486bfd44d95 100644 (file)
@@ -57,6 +57,11 @@ print 'cosh'
 testit('cosh(0)', math.cosh(0), 1)
 testit('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
 
+print 'degrees'
+testit('degrees(pi)', math.degrees(math.pi), 180.0)
+testit('degrees(pi/2)', math.degrees(math.pi/2), 90.0)
+testit('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0)
+
 print 'exp'
 testit('exp(-1)', math.exp(-1), 1/math.e)
 testit('exp(0)', math.exp(0), 1)
@@ -129,6 +134,11 @@ testit('pow(1,0)', math.pow(1,0), 1)
 testit('pow(2,1)', math.pow(2,1), 2)
 testit('pow(2,-1)', math.pow(2,-1), 0.5)
 
+print 'radians'
+testit('radians(180)', math.radians(180), math.pi)
+testit('radians(90)', math.radians(90), math.pi/2)
+testit('radians(-45)', math.radians(-45), -math.pi/4)     
+
 print 'sin'
 testit('sin(0)', math.sin(0), 0)
 testit('sin(pi/2)', math.sin(math.pi/2), 1)