#NEWLINE# def test_gini_index( self ) : #NEWLINE# #INDENT# exp = 0.32771210013908214 #NEWLINE# obs = gini_index ( self . data , 'trapezoids' ) #NEWLINE# self . assertAlmostEqual ( obs , exp ) #NEWLINE# exp = 0.20271210013908214 #NEWLINE# obs = gini_index ( self . data , 'rectangles' ) #NEWLINE# self . assertAlmostEqual ( obs , exp ) #NEWLINE# with self . assertRaises ( ValueError ) : #NEWLINE# #INDENT# gini_index ( [ 1.0 , ( - 3.1 ) , 4.5 ] )