Exemple #1
0
class TestTexts(unittest.TestCase):

    #  TODO : more tests on texts
    def setUp(self):
        self.rand_gen = RandomPoolIEMLObjectGenerator(level=SuperSentence)

    def test_text_ordering_simple(self):
        """Just checks that elements created in a text are ordered the right way"""
        word = self.rand_gen.word()
        sentence, supersentence = self.rand_gen.sentence(
        ), self.rand_gen.super_sentence()
        text = Text([supersentence, sentence, word])

        self.assertIsInstance(text.children[0], Word)
        self.assertIsInstance(text.children[1], Sentence)
        self.assertIsInstance(text.children[2], SuperSentence)
Exemple #2
0
 def test_rank(self):
     r = RandomPoolIEMLObjectGenerator(level=Text)
     self.assertEqual(r.word().__class__.syntax_rank(), 2)
     self.assertEqual(r.sentence().__class__.syntax_rank(), 4)
     self.assertEqual(r.super_sentence().__class__.syntax_rank(), 6)
     self.assertEqual(r.text().__class__.syntax_rank(), 7)