'Test the Basic Examples from the TGrep2 manual.'

def test_examples(self):

    tree = ParentedTree.fromstring(u'(S    (NP    (AP    x))    (NP    (PP    x)))')
    self.assertEqual(list(tgrep.tgrep_positions(u'NP    <    PP', [tree])), [[(1,)]])
    tree = ParentedTree.fromstring(u'(S    (NP    x)    (VP    x)    (NP    (PP    x))    (VP    x))')
    self.assertEqual(list(tgrep.tgrep_positions(u'NP    <<    PP    .    VP', [tree])), [[(2,)]])
    tree = ParentedTree.fromstring(u'(S    (NP    (AP    x))    (NP    (PP    x))    (NP    (DET    x)    (NN    x))    (VP    x))')
    self.assertEqual(list(tgrep.tgrep_positions(u'NP    <<    PP    |    .    VP', [tree])), [[(1,), (2,)]])
    tree = ParentedTree.fromstring(u'(S    (NP    (NP    (PP    x))    (NP    (AP    x)))    (VP    (AP    (NP    (PP    x))    (NP    (AP    x))))    (NP    (RC    (NP    (AP    x)))))')
    self.assertEqual(list(tgrep.tgrep_positions(u'NP    !<<    PP    [>    NP    |    >>    VP]', [tree])), [[(0, 1), (1, 0, 1)]])
    tree = ParentedTree.fromstring(u'(S    (NP    (AP    (PP    x)    (VP    x)))    (NP    (AP    (PP    x)    (NP    x)))    (NP    x))')
    self.assertEqual(list(tgrep.tgrep_positions(u'NP    <<    (PP    .    VP)', [tree])), [[(0,)]])
    tree = ParentedTree.fromstring(u'(S    (NP    (DET    a)    (NN    cat)    (PP    (IN    on)    (NP    x)))    (NP    (DET    a)    (NN    cat)    (PP    (IN    on)    (NP    x))    (PP    x))    (NP    x))')
    self.assertEqual(list(tgrep.tgrep_positions(u"NP    <'    (PP    <,    (IN    <    on))", [tree])), [[(0,)]])
    tree = ParentedTree.fromstring(u'(S    (S    (C    x)    (A    (B    x)))    (S    (C    x)    (A    x))    (S    (D    x)    (A    (B    x))))')
    self.assertEqual(list(tgrep.tgrep_positions(u'S    <    (A    <    B)    <    C', [tree])), [[(0,)]])
    tree = ParentedTree.fromstring(u'(S    (S    (A    (B    x)    (C    x)))    (S    (S    (C    x)    (A    (B    x)))))')
    self.assertEqual(list(tgrep.tgrep_positions(u'S    <    ((A    <    B)    <    C)', [tree])), [[(0,)]])
    self.assertEqual(list(tgrep.tgrep_positions(u'S    <    (A    <    B    <    C)', [tree])), [[(0,)]])
