#NEWLINE# def test_out_degree( self ) : #NEWLINE# #INDENT# G = self . G ( ) #NEWLINE# G . add_nodes_from ( 'GJK' ) #NEWLINE# G . add_edges_from ( [ ( 'A' , 'B' ) , ( 'A' , 'C' ) , ( 'B' , 'D' ) , ( 'B' , 'C' ) , ( 'C' , 'D' ) ] ) #NEWLINE# assert_equal ( sorted ( G . out_degree ( ) . values ( ) ) , [ 0 , 0 , 0 , 0 , 1 , 2 , 2 ] ) #NEWLINE# assert_equal ( G . out_degree ( ) , { #NEWLINE# #INDENT# 'A' : 2 , #NEWLINE# 'C' : 1 , #NEWLINE# 'B' : 2 , #NEWLINE# 'D' : 0 , #NEWLINE# 'G' : 0 , #NEWLINE# 'K' : 0 , #NEWLINE# 'J' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert_equal ( sorted ( [ G for ( k , v ) in G . in_degree_iter ( ) ] ) , [ 0 , 0 , 0 , 0 , 1 , 2 , 2 ] ) #NEWLINE# assert_equal ( dict ( G . out_degree_iter ( ) ) , { #NEWLINE# #INDENT# 'A' : 2 , #NEWLINE# 'C' : 1 , #NEWLINE# 'B' : 2 , #NEWLINE# 'D' : 0 , #NEWLINE# 'G' : 0 , #NEWLINE# 'K' : 0 , #NEWLINE# 'J' : 0 , #NEWLINE# #UNINDENT# } )