#NEWLINE# def test_prev( self , root ) : #NEWLINE# #INDENT# subroot = prevs . children [ 0 ] . children [ 2 ] #NEWLINE# prevs = list ( root . children [ 0 ] . children [ 0 : 2 ] ) #NEWLINE# assert ( subroot . prevAll . count ( ) == 2 ) #NEWLINE# assert ( list ( subroot . prevAll ) == prevs ) #NEWLINE# c = subroot #NEWLINE# count = 0 #NEWLINE# while True : #NEWLINE# #INDENT# c = c . prev #NEWLINE# if ( c is None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# count += 1 #NEWLINE# #UNINDENT# assert ( count == 2 )