#NEWLINE# def test_predecessor( self ) : #NEWLINE# #INDENT# G = nx . path_graph ( 4 ) #NEWLINE# assert_equal ( nx . predecessor ( G , 0 ) , { #NEWLINE# #INDENT# 0 : [ ] , #NEWLINE# 1 : [ 0 ] , #NEWLINE# 2 : [ 1 ] , #NEWLINE# 3 : [ 2 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert_equal ( nx . predecessor ( self , 0 , 3 ) , [ 2 ] ) #NEWLINE# G = nx . grid_2d_graph ( 2 , 2 ) #NEWLINE# assert_equal ( sorted ( nx . predecessor ( G , ( 0 , 0 ) ) . items ( ) ) , [ ( ( 0 , 0 ) , [ ] ) , ( ( 0 , 1 ) , [ ( 0 , 0 ) ] ) , ( ( 1 , 0 ) , [ ( 0 , 0 ) ] ) , ( ( 1 , 1 ) , [ ( 0 , 1 ) , ( 1 , 0 ) ] ) ] )