def test_leading_text_nodes(self): """Make sure the parser handles a leading naked run of text. Test inner runs of text while we're at it. """ html = 'A<i>hi</i>B<i>there</i>C' p = ForParser(html) eq_(html, p.to_unicode())
def expanded_eq(want, to_expand): """Balance and expand the fors in `to_expand`, and assert equality with `want`.""" expander = ForParser(to_expand) expander.expand_fors() eq_(want, expander.to_unicode())
def balanced_eq(want, to_balance): """Run `to_balance` through the expander to get its tags balanced, and assert the result is `want`.""" expander = ForParser(to_balance) eq_(want, expander.to_unicode())