#NEWLINE# def testFactorial( self ) : #NEWLINE# #INDENT# self . assertEqual ( math . factorial ( 0 ) , 1 ) #NEWLINE# self . assertEqual ( math . factorial ( 0.0 ) , 1 ) #NEWLINE# total = 1 #NEWLINE# for i in range ( 1 , 1000 ) : #NEWLINE# #INDENT# total *= i #NEWLINE# self . assertEqual ( math . factorial ( i ) , total ) #NEWLINE# self . assertEqual ( math . factorial ( float ( i ) ) , total ) #NEWLINE# #UNINDENT# self . assertRaises ( ValueError , math . factorial , ( - 1 ) ) #NEWLINE# self . assertRaises ( ValueError , math . factorial , ( - 1.0 ) ) #NEWLINE# self . assertRaises ( ValueError , math . factorial , math . pi ) #NEWLINE# self . assertRaises ( OverflowError , math . factorial , ( sys . maxsize + 1 ) ) #NEWLINE# self . assertRaises ( OverflowError , math . factorial , 1e+101 )