def test_wash_html_to_text(self): """webalert - stripping HTML markup for alert emails""" htparser = RecordHTMLParser() htparser.feed('''<style type="text/css"> <!-- div.thumbMosaic {display:inline;} div.thumbMosaic span{display:none;} div.thumbMosaic:hover span{display:inline;position:absolute;} --> </style><!--START_NOT_FOR_TEXT--><strong>Abracadabra!</strong><!--END_NOT_FOR_TEXT--><br/><a class="moreinfo" href="%(CFG_SITE_URL)s">Detailed Record</a>''' % {'CFG_SITE_URL': CFG_SITE_URL}) self.assertEqual('\nDetailed record : <%s>' % CFG_SITE_URL, htparser.result)
def test_character_ref_conversion(self): """webalert - convert character reference to text (Eg: 'a' -> 'a')""" htparser = RecordHTMLParser() htparser.feed('Python is cool') self.assertEqual('Python is cool', htparser.result)
def test_entity_ref_conversion(self): """webalert - convert entity reference to text (Eg: '<' -> '<')""" htparser = RecordHTMLParser() htparser.feed('<strong>a < b > c</strong> ©CERN') self.assertEqual('a < b > c ©CERN', htparser.result)