#NEWLINE# def test_weighted_average_shortest_path( self ) : #NEWLINE# #INDENT# G = nx . Graph ( ) #NEWLINE# G . add_cycle ( range ( 7 ) , weight = 2 ) #NEWLINE# l = nx . average_shortest_path_length ( G , weight = 'weight' ) #NEWLINE# assert_almost_equal ( l , 4 ) #NEWLINE# G = nx . Graph ( ) #NEWLINE# G . add_path ( range ( 5 ) , weight = 2 ) #NEWLINE# l = nx . average_shortest_path_length ( G , weight = 'weight' ) #NEWLINE# assert_almost_equal ( l , 4 )