import nose

from parser_tool import get_parser, parse

sentences = (
    # N[s] V[i]
    "Brad drives",
    # N[s] V[t] N[p]
    "Angela drives cars",
    # N[s] V[t] Det N[s]
    "Brad buys the house",
    # Det[s] N[s] V[i]
    "a dog walks"
)

grammar = get_parser("grammars/feat1.fcfg", trace=0)

def test_grammar():
    global sentences, parser

    for sent in sentences:
        print "Testing: %s" % sent
        trees = parse(grammar, sent)
        assert len(trees) > 0

if __name__=="__main__":
    nose.main()

@@ -69,20 +69,18 @@
 (%0A    # 
+P
 N
-%5Bs%5D
  V%5Bi%5D%0A  
@@ -98,28 +98,26 @@
 ves%22,%0A    # 
+P
 N
-%5Bs%5D
  V%5Bt%5D N%5Bp%5D%0A 
@@ -147,20 +147,18 @@
 ,%0A    # 
+P
 N
-%5Bs%5D
  V%5Bt%5D De
@@ -210,24 +210,24 @@
 %5D N%5Bs%5D V%5Bi%5D%0A
-
     %22a dog w
@@ -231,16 +231,303 @@
 g walks%22
+,%0A    # Det%5Bp%5D N%5Bp%5D V%5Bi%5D%0A    %22these dogs walk%22,%0A    # Det%5Bp%5D N%5Bp%5D V%5Bt%5D Det N%5Bs%5D%0A    %22the cars enter the house%22,%0A    # A N%5Bp%5D V%5Bt%5D Det N%5Bs%5D%0A    %22red cars enter the house%22,%0A    # Det A N%5Bs%5D V%5Bt%5D Det N%5Bs%5D%0A    %22a red car enters the house%22,%0A    # PN V%5Bt%5D Det A N%5Bs%5D%0A    %22Brad buys a red car%22,
 %0A)%0A%0Agram

Increase testing coverage of grammar