def test_str(self): raw = '<p class="first">A Text Element</p>' attr = HTMLAttribute(raw='class="first"', start=3, ident='class', value='first') attrs = HTMLAttributes(raw='class="first"', start=3, attributes=[attr]) open_tag = HTMLOpenTag(raw='<p class="first">', tag='p', attributes=attrs) close_tag = HTMLCloseTag(raw='</p>', start=31, tag='p') children = [HTMLInterval(raw='A Text Element', start=17)] element = HTMLElement(raw=raw, open_tag=open_tag, close_tag=close_tag, children=children) self.assertEqual(raw, str(element))
def test_to_text(self): interval = HTMLInterval(raw='Interval') self.assertEqual('', interval.to_text())
def test_to_html(self): interval = HTMLInterval(raw='Interval') self.assertEqual('Interval', interval.to_html())
def test_str(self): interval = HTMLInterval(raw='Interval') self.assertEqual('Interval', text_type(interval))