def test_doc_api_right_edge(en_tokenizer):
 text = u'I have proposed to myself, for the sake of such as live under the government of the Romans, to translate those books into the Greek tongue.'
 heads = [2, 1, 0, (-1), (-1), (-3), 15, 1, (-2), (-1), 1, (-3), (-1), (-1), 1, (-2), (-1), 1, (-2), (-7), 1, (-19), 1, (-2), (-3), 2, 1, (-3), (-26)]
 tokens = en_tokenizer(text)
 doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads)
 assert (doc[6].text == u'for')
 subtree = [w.text for w in doc[6].subtree]
 assert (subtree == [u'for', u'the', u'sake', u'of', u'such', u'as', u'live', u'under', u'the', u'government', u'of', u'the', u'Romans', u','])
 assert (doc[6].right_edge.text == u',')

def test_doc_api_right_edge ( en_tokenizer ) : text = u'I have proposed to myself, for the sake of such as live under the government of the Romans, to translate those books into the Greek tongue.' heads = [ 2 , 1 , 0 , ( - 1 ) , ( - 1 ) , ( - 3 ) , 15 , 1 , ( - 2 ) , ( - 1 ) , 1 , ( - 3 ) , ( - 1 ) , ( - 1 ) , 1 , ( - 2 ) , ( - 1 ) , 1 , ( - 2 ) , ( - 7 ) , 1 , ( - 19 ) , 1 , ( - 2 ) , ( - 3 ) , 2 , 1 , ( - 3 ) , ( - 26 ) ] tokens = en_tokenizer ( text ) doc = get_doc ( tokens . vocab , [ t . text for t in tokens ] , heads = heads ) assert ( doc [ 6 ] . text == u'for' ) subtree = [ w . text for w in doc [ 6 ] . subtree ] assert ( subtree == [ u'for' , u'the' , u'sake' , u'of' , u'such' , u'as' , u'live' , u'under' , u'the' , u'government' , u'of' , u'the' , u'Romans' , u',' ] ) assert ( doc [ 6 ] . right_edge . text == u',' )
test for bug occurring from unshift action .