Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64108af

Browse files
committed
Adds tests for degrees() and radians() functions added to mathmodule.
Closes patch 552452 and feature request 426539.
1 parent c045b49 commit 64108af

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/test/test_math.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def testit(name, value, expected):
5757
testit('cosh(0)', math.cosh(0), 1)
5858
testit('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
5959

60+
print 'degrees'
61+
testit('degrees(pi)', math.degrees(math.pi), 180.0)
62+
testit('degrees(pi/2)', math.degrees(math.pi/2), 90.0)
63+
testit('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0)
64+
6065
print 'exp'
6166
testit('exp(-1)', math.exp(-1), 1/math.e)
6267
testit('exp(0)', math.exp(0), 1)
@@ -129,6 +134,11 @@ def testmodf(name, (v1, v2), (e1, e2)):
129134
testit('pow(2,1)', math.pow(2,1), 2)
130135
testit('pow(2,-1)', math.pow(2,-1), 0.5)
131136

137+
print 'radians'
138+
testit('radians(180)', math.radians(180), math.pi)
139+
testit('radians(90)', math.radians(90), math.pi/2)
140+
testit('radians(-45)', math.radians(-45), -math.pi/4)
141+
132142
print 'sin'
133143
testit('sin(0)', math.sin(0), 0)
134144
testit('sin(pi/2)', math.sin(math.pi/2), 1)

0 commit comments

Comments
 (0)