#NEWLINE# def test_extreme_example( self ) : #NEWLINE# #INDENT# self . label = numpy . array ( range ( 16 ) ) . reshape ( ( 4 , 4 ) ) #NEWLINE# ( adj_mat , adj_dic ) = selective_search . _calc_adjacency_matrix ( self . label , 16 ) #NEWLINE# assert numpy . array_equal ( adj_mat . transpose ( ) , adj_mat ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 0 ] ) ) == { 0 , 1 , 4 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 1 ] ) ) == { 0 , 1 , 2 , 5 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 2 ] ) ) == { 1 , 2 , 3 , 6 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 3 ] ) ) == { 2 , 3 , 7 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 4 ] ) ) == { 0 , 4 , 5 , 8 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 5 ] ) ) == { 1 , 4 , 5 , 6 , 9 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 6 ] ) ) == { 2 , 5 , 6 , 7 , 10 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 7 ] ) ) == { 3 , 6 , 7 , 11 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 8 ] ) ) == { 4 , 8 , 9 , 12 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 9 ] ) ) == { 5 , 8 , 9 , 10 , 13 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 10 ] ) ) == { 6 , 9 , 10 , 11 , 14 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 11 ] ) ) == { 7 , 10 , 11 , 15 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 12 ] ) ) == { 8 , 12 , 13 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 13 ] ) ) == { 9 , 12 , 13 , 14 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 14 ] ) ) == { 10 , 13 , 14 , 15 } ) #NEWLINE# assert ( set ( numpy . flatnonzero ( adj_mat [ 15 ] ) ) == { 11 , 14 , 15 } ) #NEWLINE# for ( i , adj_labels ) in adj_dic . items ( ) : #NEWLINE# #INDENT# assert ( ( set ( numpy . flatnonzero ( adj_mat [ i ] ) ) - { i } ) == adj_labels )