예제 #1
0
    def test_outdent_parse(self):
        text = "\n".join(
            [
                SECTION1,
                LEVEL0,
                LEVEL0 + SIGNATURE,
                LEVEL1,
                LEVEL1 + SIGNATURE,
                LEVEL2 + SIGNATURE,
                OUTDENT + LEVEL0 + SIGNATURE
            ]
        )

        output = tpp.parse(text)

        self.assertTrue(verify(output), error_msg(output))
        self.assertEqual(len(output['sections']), 1)
        self.assertEqual(len(output['sections'][0]['comments']), 1)
        self.assertEqual(len(output['sections'][0]['comments'][0]['comments']), 1)
        self.assertEqual(len(output['sections'][0]
                                   ['comments'][0]
                                   ['comments'][0]
                                   ['comments']), 1)
        self.assertEqual(len(output['sections'][0]
                                   ['comments'][0]
                                   ['comments'][0]
                                   ['comments'][0]
                                   ['comments']), 1)
예제 #2
0
    def test_multi_sections(self):
        text = "\n".join(
            [
                SECTION1,
                LEVEL0,
                LEVEL0 + SIGNATURE,
                SECTION1,
                LEVEL0,
                LEVEL0 + SIGNATURE,
            ]
        )

        output = tpp.parse(text)

        self.assertTrue(verify(output), error_msg(output))
        self.assertEqual(len(output['sections']), 2)
        self.assertEqual(len(output['sections'][0]['comments']), 1)
        self.assertEqual(len(output['sections'][1]['comments']), 1)