def test_enumerate_gsimple_VP(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('VP')], 3)
     assert es.flattened(sentences) == \
         ['saw the man', 'saw the park', 'saw the dog', 'saw the telescope',
          'saw a man', 'saw a park', 'saw a dog', 'saw a telescope',
          'walked the man', 'walked the park', 'walked the dog',
          'walked the telescope', 'walked a man', 'walked a park',
          'walked a dog', 'walked a telescope']
 def test_enumerate_gsimple_NP(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('NP')], 2)
     assert es.flattened(sentences) == \
         ['the man', 'the park', 'the dog', 'the telescope',
          'a man', 'a park', 'a dog', 'a telescope']
 def test_enumerate_gsimple_V(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('V')], 1)
     assert es.flattened(sentences) == ['saw', 'walked']
 def test_enumerate_gsimple_P(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('P')], 1)
     assert es.flattened(sentences) == ['in', 'with']
 def test_enumerate_gsimple_Det(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('Det')], 1)
     assert es.flattened(sentences) == ['the', 'a']
 def test_enumerate_gsimple_N(self, gsimple):
     sentences = es._enumerate(gsimple, [Nonterminal('N')], 1)
     assert es.flattened(sentences) == ['man', 'park', 'dog', 'telescope']
 def test_flattened_sentense(self):
     assert es.flattened(['the', 'fox', 'jumps']) == 'the fox jumps'
     assert es.flattened(['the', 'quick', 'brown', 'fox', 'jumps', 'over',
                          'the', 'lazy', 'dog']) \
                          == 'the quick brown fox jumps over the lazy dog'
 def test_flattened_sentenses(self):
     assert es.flattened([['the', 'fox', 'jumps'], ['a', 'man', 'walks']]) \
         == ['the fox jumps', 'a man walks']
     assert es.flattened([['an', 'apple'], ['the', 'orange'],
                          ['my', 'pencil']]) \
         == ['an apple', 'the orange', 'my pencil']
def assert_unique(sentences):
    assert len(sentences) == len(set(es.flattened(sentences)))
 def test_enumerate_gtong_IVsing(self, gtong):
     sentences = es._enumerate(gtong, [Nonterminal('IVsing')], 1)
     assert es.flattened(sentences) == ['walks', 'lives']
 def test_enumerate_gtong_PropN(self, gtong):
     sentences = es._enumerate(gtong, [Nonterminal('PropN')], 1)
     assert es.flattened(sentences) == ['John', 'Mary']