summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-05-13 03:55:01 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-05-13 03:55:01 (GMT)
commit64108afa609104c9d63e70a0ec4b50da318bd7f9 (patch)
tree9a398f04fda57d6e289964480a3b97d2c9db6d60 /Lib/test/test_math.py
parentc045b49633b6200a979894aa88dd09d5ca4eb6bf (diff)
downloadcpython-64108afa609104c9d63e70a0ec4b50da318bd7f9.zip
cpython-64108afa609104c9d63e70a0ec4b50da318bd7f9.tar.gz
cpython-64108afa609104c9d63e70a0ec4b50da318bd7f9.tar.bz2
Adds tests for degrees() and radians() functions added to mathmodule.
Closes patch 552452 and feature request 426539.
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 743d46b..cb2b86c 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -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)