#NEWLINE# def tests_rel_dominance( self ) : #NEWLINE# #INDENT# '\n        Test matching nodes based on dominance relations.\n        ' #NEWLINE# tree = ParentedTree . fromstring ( '(S (A (T x)) (B (N x)))' ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* < T' , [ tree ] ) ) , [ [ ( 0 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* < T > S' , [ tree ] ) ) , [ [ ( 0 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !< T' , [ tree ] ) ) , [ [ ( ) , ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 1 , ) , ( 1 , 0 ) , ( 1 , 0 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !< T > S' , [ tree ] ) ) , [ [ ( 1 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* > A' , [ tree ] ) ) , [ [ ( 0 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* > B' , [ tree ] ) ) , [ [ ( 1 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !> B' , [ tree ] ) ) , [ [ ( ) , ( 0 , ) , ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 1 , ) , ( 1 , 0 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !> B >> S' , [ tree ] ) ) , [ [ ( 0 , ) , ( 0 , 0 ) , ( 1 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* >> S' , [ tree ] ) ) , [ [ ( 0 , ) , ( 0 , 0 ) , ( 1 , ) , ( 1 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* >>, S' , [ tree ] ) ) , [ [ ( 0 , ) , ( 0 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( "* >>' S" , [ tree ] ) ) , [ [ ( 1 , ) , ( 1 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* << T' , [ tree ] ) ) , [ [ ( ) , ( 0 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( "* <<' T" , [ tree ] ) ) , [ [ ( 0 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* <<1 N' , [ tree ] ) ) , [ [ ( 1 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !<< T' , [ tree ] ) ) , [ [ ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 1 , ) , ( 1 , 0 ) , ( 1 , 0 , 0 ) ] ] ) #NEWLINE# tree = ParentedTree . fromstring ( '(S (A (T x)) (B (T x) (N x )))' ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* <: T' , [ tree ] ) ) , [ [ ( 0 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* < T' , [ tree ] ) ) , [ [ ( 0 , ) , ( 1 , ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !<: T' , [ tree ] ) ) , [ [ ( ) , ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 1 , ) , ( 1 , 0 ) , ( 1 , 0 , 0 ) , ( 1 , 1 ) , ( 1 , 1 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !<: T > S' , [ tree ] ) ) , [ [ ( 1 , ) ] ] ) #NEWLINE# tree = ParentedTree . fromstring ( '(S (T (A x) (B x)) (T (C x)))' ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* >: T' , [ tree ] ) ) , [ [ ( 1 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* !>: T' , [ tree ] ) ) , [ [ ( ) , ( 0 , ) , ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 0 , 1 ) , ( 0 , 1 , 0 ) , ( 1 , ) , ( 1 , 0 , 0 ) ] ] ) #NEWLINE# tree = ParentedTree . fromstring ( '(S (A (B (C (D (E (T x)))))) (A (B (C (D (E (T x))) (N x)))))' ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* <<: T' , [ tree ] ) ) , [ [ ( 0 , ) , ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 0 , 0 , 0 , 0 ) , ( 0 , 0 , 0 , 0 , 0 ) , ( 1 , 0 , 0 , 0 ) , ( 1 , 0 , 0 , 0 , 0 ) ] ] ) #NEWLINE# self . assertEqual ( list ( tgrep . tgrep_positions ( '* >>: A' , [ tree ] ) ) , [ [ ( 0 , 0 ) , ( 0 , 0 , 0 ) , ( 0 , 0 , 0 , 0 ) , ( 0 , 0 , 0 , 0 , 0 ) , ( 0 , 0 , 0 , 0 , 0 , 0 ) , ( 1 , 0 ) , ( 1 , 0 , 0 ) ] ] )