Exemplo n.º 1
0
    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())
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
 def on_own_line_eq(want, text):
     """Assert that on_own_line operates as expected on the first match
     in `text`."""
     match = ForParser._FOR_OR_CLOSER.search(text)
     eq_(want, ForParser._on_own_line(match, match.groups(3)))
Exemplo n.º 4
0
def strip_eq(want, text):
    eq_(want, ForParser.strip_fors(text)[0])
Exemplo n.º 5
0
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, str(expander))
Exemplo n.º 6
0
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, str(expander))
Exemplo n.º 7
0
 def on_own_line_eq(want, text):
     """Assert that on_own_line operates as expected on the first match
     in `text`."""
     match = ForParser._FOR_OR_CLOSER.search(text)
     eq_(want, ForParser._on_own_line(match, match.groups(3)))
Exemplo n.º 8
0
def strip_eq(want, text):
    eq_(want, ForParser.strip_fors(text)[0])
Exemplo n.º 9
0
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())
Exemplo n.º 10
0
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())