#NEWLINE# def test_extend( self ) : #NEWLINE# #INDENT# 'Extend a few nodes' #NEWLINE# second_tree = TreeNode . read ( io . StringIO ( '(x1,y1)z1;' ) ) #NEWLINE# third_tree = TreeNode . read ( io . StringIO ( '(x2,y2)z2;' ) ) #NEWLINE# first_tree = TreeNode . read ( io . StringIO ( '(x1,y1)z1;' ) ) #NEWLINE# fourth_tree = TreeNode . read ( io . StringIO ( '(x2,y2)z2;' ) ) #NEWLINE# self . simple_t . extend ( [ second_tree , third_tree ] ) #NEWLINE# first_tree . extend ( fourth_tree . children ) #NEWLINE# self . assertEqual ( 0 , len ( fourth_tree . children ) ) #NEWLINE# self . assertEqual ( first_tree . children [ 0 ] . name , 'x1' ) #NEWLINE# self . assertEqual ( first_tree . children [ 1 ] . name , 'y1' ) #NEWLINE# self . assertEqual ( first_tree . children [ 2 ] . name , 'x2' ) #NEWLINE# self . assertEqual ( first_tree . children [ 3 ] . name , 'y2' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 0 ] . name , 'i1' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 1 ] . name , 'i2' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 2 ] . name , 'z1' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 3 ] . name , 'z2' ) #NEWLINE# self . assertEqual ( len ( self . simple_t . children ) , 4 ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 2 ] . children [ 0 ] . name , 'x1' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 2 ] . children [ 1 ] . name , 'y1' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 3 ] . children [ 0 ] . name , 'x2' ) #NEWLINE# self . assertEqual ( self . simple_t . children [ 3 ] . children [ 1 ] . name , 'y2' ) #NEWLINE# self . assertIs ( second_tree . parent , self . simple_t ) #NEWLINE# self . assertIs ( third_tree . parent , self . simple_t )