#NEWLINE# def test_attracting_components( self ) : #NEWLINE# #INDENT# ac = list ( nx . attracting_components ( self . G1 ) ) #NEWLINE# assert_true ( ( { 2 } in ac ) ) #NEWLINE# assert_true ( ( { 9 } in ac ) ) #NEWLINE# assert_true ( ( { 10 } in ac ) ) #NEWLINE# ac = list ( nx . attracting_components ( self . G2 ) ) #NEWLINE# ac = [ tuple ( sorted ( x ) ) for x in ac ] #NEWLINE# assert_true ( ( ac == [ ( 1 , 2 ) ] ) ) #NEWLINE# ac = list ( nx . attracting_components ( self . G3 ) ) #NEWLINE# ac = [ tuple ( sorted ( x ) ) for x in ac ] #NEWLINE# assert_true ( ( ( 1 , 2 ) in ac ) ) #NEWLINE# assert_true ( ( ( 3 , 4 ) in ac ) ) #NEWLINE# assert_equal ( len ( ac ) , 2 )