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)
def modify(self, text): """Trims non-breaking whitespace from all lines.""" return whitespace_utils.trim_nonbreaking_whitespace(text)