#NEWLINE# def test_density( ) : #NEWLINE# #INDENT# rng = np . random . RandomState ( 0 ) #NEWLINE# X = rng . randint ( 10 , size = ( 10 , 5 ) ) #NEWLINE# X [ ( 1 , 2 ) ] = 0 #NEWLINE# X [ ( 5 , 3 ) ] = 0 #NEWLINE# X_csr = sparse . csr_matrix ( X ) #NEWLINE# X_csc = sparse . csc_matrix ( X ) #NEWLINE# X_coo = sparse . coo_matrix ( X ) #NEWLINE# X_lil = sparse . lil_matrix ( X ) #NEWLINE# for X_ in ( X_csr , X , X_coo , X_lil ) : #NEWLINE# #INDENT# assert_equal ( density ( X_ ) , density ( X ) )