#NEWLINE# def testTraverseIgnoreSubtrie( self ) : #NEWLINE# #INDENT# t = pygtrie . CharTrie ( ) #NEWLINE# t . update ( { #NEWLINE# #INDENT# 'aaa' : 1 , #NEWLINE# 'aab' : 2 , #NEWLINE# 'aac' : 3 , #NEWLINE# 'b' : 4 , #NEWLINE# #UNINDENT# } ) #NEWLINE# cnt = [ 0 ] #NEWLINE# def make( path_conv , path , children , value = self . _SENTINEL ) : #NEWLINE# #INDENT# cnt [ 0 ] += 1 #NEWLINE# if ( path and ( path [ 0 ] == 'a' ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . _TestNode ( path_conv ( path ) , filter ( None , children ) , value ) #NEWLINE# #UNINDENT# #UNINDENT# r = t . traverse ( make ) #NEWLINE# self . assertNode ( r , '' , 1 ) #NEWLINE# self . assertNode ( r . children [ 0 ] , 'b' , 0 , 4 ) #NEWLINE# self . assertEquals ( 3 , cnt [ 0 ] )