def test_remove_whitespace_before_abbreviation_definition_removes_leading_whitespace_with_multiple_abbreviations(self): s = u"adsfsdfsd and PSV\n \n *[adsfsdfsd]: PSV!!!" + \ u"\n *[PSV]: Philips Sport Vereniging\n" expected = u"adsfsdfsd and PSV\n \n*[adsfsdfsd]: PSV!!!" + \ u"\n*[PSV]: Philips Sport Vereniging\n" result = utility.remove_whitespace_before_abbreviation_definition(s) self.assertEqual(expected, result)
def test_remove_whitespace_before_abbreviation_definition_does_not_make_changes_when_no_leading_whitespace(self): s = u"""The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium""" expected = s result = utility.remove_whitespace_before_abbreviation_definition(s) self.assertEqual(expected, result)
def test_remove_whitespace_before_abbreviation_definition_does_not_remove_leading_whitespace_when_pattern_does_not_match(self): s = u"adsfsdfsd and PSV\n \n [adsfsdfsd]: PSV!!!" expected = u"adsfsdfsd and PSV\n \n [adsfsdfsd]: PSV!!!" result = utility.remove_whitespace_before_abbreviation_definition(s) self.assertEqual(expected, result)
def test_remove_whitespace_before_abbreviation_definition_removes_leading_whitespace_after_newline(self): s = u"adsfsdfsd\n \n *[adsfsdfsd]: PSV!!!\n" expected = u'adsfsdfsd\n \n*[adsfsdfsd]: PSV!!!\n' result = utility.remove_whitespace_before_abbreviation_definition(s) self.assertEqual(expected, result)