Example #1
0
 def test_unhtmlify(self):
     self.assertEqual(lib.unhtmlify(''), '')
     self.assertEqual(lib.unhtmlify('str'), 'str')
     self.assertEqual(lib.unhtmlify('<a>str</a>'), 'str')
     self.assertEqual(lib.unhtmlify('<a> str </a>'), ' str ')
     self.assertEqual(lib.unhtmlify('<a>str'), 'str')
     self.assertEqual(lib.unhtmlify('a <tag> b'), 'a  b')
     self.assertEqual(lib.unhtmlify('a.<tag> b'), 'a. b')
Example #2
0
    def __init__(self, bubble):
        """
        Convert given bubble to reduced bubble holding only the core values.

        :param bubble:
        """
        self.type = self.__demultiplex_bubbletype(bubble)
        self.html = bubble['message']
        self.url = bubble['bubble_url'] if bubble['bubble_url'] != '' else None
        self.text = unhtmlify(bubble['message'])
Example #3
0
    def __init__(self, htmls: List[str], url: str):
        """
        Construct item for items-dict.

        :param htmls: List of strings containing html, which is also converted to plain text
        :param url: URL to next step in the discussion
        """
        self.url = url if url != '' else None
        self.htmls = htmls
        self.texts = [unhtmlify(html) for html in htmls]
Example #4
0
 def test_unhtmlify(self):
     self.assertEqual('', lib.unhtmlify(''))
     self.assertEqual('str', lib.unhtmlify('str'))
     self.assertEqual('str', lib.unhtmlify('str'))