#NEWLINE# def test_dfs( self ) : #NEWLINE# #INDENT# node = Node ( 5 ) #NEWLINE# insert ( node , 2 ) #NEWLINE# insert ( node , 8 ) #NEWLINE# insert ( node , 1 ) #NEWLINE# insert ( node , 3 ) #NEWLINE# in_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( node . results ) , '[1, 2, 3, 5, 8]' ) #NEWLINE# self . results . clear_results ( ) #NEWLINE# pre_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( self . results ) , '[5, 2, 1, 3, 8]' ) #NEWLINE# self . results . clear_results ( ) #NEWLINE# post_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( self . results ) , '[1, 3, 2, 8, 5]' ) #NEWLINE# self . results . clear_results ( ) #NEWLINE# node = Node ( 1 ) #NEWLINE# insert ( node , 2 ) #NEWLINE# insert ( node , 3 ) #NEWLINE# insert ( node , 4 ) #NEWLINE# insert ( node , 5 ) #NEWLINE# in_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( self . results ) , '[1, 2, 3, 4, 5]' ) #NEWLINE# self . results . clear_results ( ) #NEWLINE# pre_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( self . results ) , '[1, 2, 3, 4, 5]' ) #NEWLINE# self . results . clear_results ( ) #NEWLINE# post_order_traversal ( node , self . results . add_result ) #NEWLINE# assert_equal ( str ( self . results ) , '[5, 4, 3, 2, 1]' ) #NEWLINE# print ( 'Success: test_dfs' )