def test_fixOrderedListNumbering(self, mock_process_groups):

        input_text = 'this is the input'
        expected = 'this is the different'

        mock_process_groups.return_value = expected

        actual = list_utils.fix_ordered_list_numbering(input_text)

        mock_process_groups.assert_called_with(input_text,
                                               is_group_member=list_utils._is_ordered_list_item,
                                               process_group=list_utils._format_ordered_list)

        self.assertEqual(actual, expected)
    def test_cleanToClean(self):

        with open(CLEAN_FILE_PATH) as clean_file:
            expected = clean_file.read()

        actual = bold_utils.convert_bolds(expected)
        actual = header_utils.fix_header_balancing(actual)
        actual = horizontal_rule_utils.convert_horizontal_rules(actual)
        actual = italic_utils.convert_italics(actual)
        actual = link_utils.discover_missing_links(actual)
        actual = link_utils.format_link_reference_definitions(actual)
        actual = list_utils.alternate_unordered_list_delimiters(actual)
        actual = list_utils.fix_ordered_list_numbering(actual)
        actual = whitespace_utils.trim_nonbreaking_whitespace(actual)

        self.assertEqual(actual, expected)
    def test_dirtyToClean_atx_unbalanced(self):

        with open(DIRTY_FILE_PATH) as dirty_file:
            text = dirty_file.read()
        with open(CLEAN_ANY_HEADER_UNBALANCED_FILE_PATH) as clean_file:
            expected = clean_file.read()

        actual = bold_utils.convert_bolds(text)
        actual = header_utils.fix_header_balancing(actual, balancing=header_utils.UNBALANCED)
        actual = horizontal_rule_utils.convert_horizontal_rules(actual)
        actual = italic_utils.convert_italics(actual)
        actual = link_utils.discover_missing_links(actual)
        actual = link_utils.format_link_reference_definitions(actual)
        actual = list_utils.alternate_unordered_list_delimiters(actual)
        actual = list_utils.fix_ordered_list_numbering(actual)
        actual = whitespace_utils.trim_nonbreaking_whitespace(actual)

        self.assertEqual(actual, expected)
示例#4
0
    def modify(self, text):
        """Fixes the number for ordered lists."""

        return list_utils.fix_ordered_list_numbering(text)