Skip to content

Commit 66f67f7

Browse files
committed
add tests for math.exp2
1 parent 5ab6380 commit 66f67f7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Lib/test/test_math.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,16 @@ def testExp(self):
501501
self.assertTrue(math.isnan(math.exp(NAN)))
502502
self.assertRaises(OverflowError, math.exp, 1000000)
503503

504+
def testExp2(self):
505+
self.assertRaises(TypeError, math.exp2)
506+
self.ftest('exp2(-1)', math.exp2(-1), 0.5)
507+
self.ftest('exp2(0)', math.exp2(0), 1)
508+
self.ftest('exp2(1)', math.exp2(1), 2)
509+
self.assertEqual(math.exp2(INF), INF)
510+
self.assertEqual(math.exp2(NINF), 0.)
511+
self.assertTrue(math.isnan(math.exp2(NAN)))
512+
self.assertRaises(OverflowError, math.exp2, 1000000)
513+
504514
def testFabs(self):
505515
self.assertRaises(TypeError, math.fabs)
506516
self.ftest('fabs(-1)', math.fabs(-1), 1)

0 commit comments

Comments
 (0)