#NEWLINE# def test_on_ex( self ) : #NEWLINE# #INDENT# a = np . vstack ( [ np . eye ( 3 ) , np . ones ( ( 1 , 3 ) ) ] ) #NEWLINE# b = np . array ( [ [ 1.0 , 0.0 , 0.0 ] , [ 1.0 , 1.0 , 0.0 ] , [ 1.0 , 0.0 , 0.0 ] , [ 0.0 , 2.0 , 1.0 ] ] ) #NEWLINE# ok = np . sqrt ( np . array ( [ 1.0 , 0.5 , 0.0 , ( 3.0 / 5.0 ) ] ) ) #NEWLINE# np . testing . assert_allclose ( cosine_similarity ( a , b ) , ok )