#NEWLINE# def test_as_greyscale_average( ) : #NEWLINE# #INDENT# ones = np . ones ( [ 3 , 120 , 120 ] ) #NEWLINE# image = Image ( ones , copy = True ) #NEWLINE# image . pixels [ 0 ] . fill ( 0.5 ) #NEWLINE# new_image = image . as_greyscale ( mode = 'average' ) #NEWLINE# assert ( new_image . shape == image . shape ) #NEWLINE# assert ( ones . n_channels == 1 ) #NEWLINE# assert_allclose ( new_image . pixels [ 0 ] , ( ones [ 0 ] * 0.83333333 ) )