Esempio n. 1
0
    def test_lexicalise_section(self):
        """ Test lexicalisation of Section. """
        m = Message('Elaboration', DummyMsg(), DummyMsg(), DummyMsg())
        p = Paragraph(m)
        s = Section('Section 1', p)
        tmp = lexicalise_section(s)
        expected = 'Section 1\n\tBoris is fast Boris is fast Boris is fast'
        self.assertEqual(expected, real(tmp))

        s = Section('Section 1', p, p, p)
        tmp = lexicalise_section(s)
        expected = 'Section 1' + \
            '\n\tBoris is fast Boris is fast Boris is fast' + \
            '\n\tBoris is fast Boris is fast Boris is fast' + \
            '\n\tBoris is fast Boris is fast Boris is fast'
        self.assertEqual(expected, real(tmp))
Esempio n. 2
0
 def test_lexicalise_paragraph2(self):
     """ Test lexicalisation of Paragraph. """
     m = Message('Elaboration', DummyMsg(), DummyMsg(), DummyMsg())
     p = Paragraph(m)
     tmp = lexicalise_paragraph(p)
     expected = '\tBoris is fast Boris is fast Boris is fast'
     self.assertEqual(expected, real(tmp))
Esempio n. 3
0
 def test_lexicalise_document(self):
     """ Test lexicalisation of Document. """
     m1 = Message('Leaf', DummyMsg())
     m2 = Message('Elaboration', DummyMsg(), DummyMsg())
     p = Paragraph(m1, m2)
     s = Section('Section One', Paragraph(m1))
     d = Document('Doc Title', s, Section('Section Two', Paragraph(m2)))
     tmp = lexicalise_document(d)
     expected = 'Doc Title\n' + \
         'Section One' + \
         '\n\tBoris is fast' + \
         '\n\nSection Two' + \
         '\n\tBoris is fast Boris is fast'
     self.assertEqual(expected, real(tmp))