Пример #1
0
    def test_different_lists(self):
        unordered = trees.lm2tm2t(False)
        ordered = trees.lm2tm2t(True)
        _, _, errors = diff_struct(unordered, ordered)

        with self.subTest('missing unordered list'):
            actual = errors[0].node
            self.assertEqual(actual, List(ordered=False))
            self.assertEqual(actual.meta.get('style'), 'del')
        with self.subTest('additional ordered list'):
            actual = errors[1].node
            self.assertEqual(actual, List(ordered=True))
            self.assertEqual(actual.meta.get('style'), 'ins')
Пример #2
0
 def test_different_header(self):
     _, _, errors = diff_struct(trees.r2t(), trees.r4t())
     self.assertEqual(2, errors[0].node.level)
     self.assertEqual('del', errors[0].node.meta['style'])
     self.assertEqual(4, errors[1].node.level)
     self.assertEqual('ins', errors[1].node.meta['style'])
Пример #3
0
 def test_missing_new_line(self):
     _, _, errors = diff_struct(trees.pt(), trees.ptnt())
     self.assertEqual('n', errors[0].node.symbol)
     self.assertEqual('text', errors[1].node.text)
Пример #4
0
 def test_concatenate_text_nodes_when_element_in_middle_ignored(self):
     _, _, errors = diff_struct(trees.ptat(), trees.pt())
     self.assertEqual([], errors)
Пример #5
0
 def test_header_in_list(self):
     _, _, errors = diff_struct(trees.lm2tm2t(), trees.lm2tm2t())
     self.assertEqual([], errors)
Пример #6
0
 def test_link_in_paragraph(self):
     _, _, errors = diff_struct(trees.ptat(), trees.ptat())
     self.assertEqual([], errors)
Пример #7
0
 def test_single_paragraph(self):
     _, _, errors = diff_struct(trees.pt(), trees.pt())
     self.assertEqual([], errors)
Пример #8
0
 def test_single_header(self):
     _, _, errors = diff_struct(trees.r2t(), trees.r2t())
     self.assertEqual([], errors)